Change Catalsyt _parse_attrs so that when sub attr handlers:
[catagits/Catalyst-Runtime.git] / t / aggregate / live_component_controller_attributes.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use Data::Dumper;
7 $Data::Dumper::Maxdepth=1;
8 use FindBin;
9 use lib "$FindBin::Bin/../lib";
10
11 use Test::More tests => 13;
12 use Catalyst::Test 'TestApp';
13
14 sub ok_actions {
15     my ($response, $actions, $msg) = @_;
16     my $expected = join ", ",
17         (map { "TestApp::Controller::Attributes->$_" } @$actions),
18         'TestApp::Controller::Root->end';
19     is( $response->header('x-catalyst-executed') => $expected,
20         $msg//'Executed correct acitons');
21     }
22
23 ok( my $response = request('http://localhost/attributes/view'),
24     'get /attributes/view' );
25 ok( !$response->is_success, 'Response Unsuccessful' );
26
27 ok( $response = request('http://localhost/attributes/foo'),
28     "get /attributes/foo" );
29 ok_actions($response => ['foo']);
30
31 ok( $response = request('http://localhost/attributes/all_attrs'),
32     "get /attributes/all_attrs" );
33 ok( $response->is_success, "Response OK" );
34 ok_actions($response => [qw/fetch all_attrs_action/]);
35
36 ok( $response = request('http://localhost/attributes/some_attrs'),
37     "get /attributes/some_attrs" );
38 ok( $response->is_success, "Response OK" );
39 ok_actions($response => [qw/fetch some_attrs_action/]);
40
41 ok( $response = request('http://localhost/attributes/one_attr'),
42     "get /attributes/one_attr" );
43 ok( $response->is_success, "Response OK" );
44 ok_actions($response => [qw/fetch one_attr_action/]);
45
46