Change Catalsyt _parse_attrs so that when sub attr handlers:
[catagits/Catalyst-Runtime.git] / t / aggregate / live_component_controller_attributes.t
CommitLineData
683d672b 1#!perl
2
3use strict;
4use warnings;
5
0b0aee67 6use Data::Dumper;
7$Data::Dumper::Maxdepth=1;
683d672b 8use FindBin;
9use lib "$FindBin::Bin/../lib";
10
0b0aee67 11use Test::More tests => 13;
683d672b 12use Catalyst::Test 'TestApp';
13
0b0aee67 14sub 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
683d672b 23ok( my $response = request('http://localhost/attributes/view'),
24 'get /attributes/view' );
25ok( !$response->is_success, 'Response Unsuccessful' );
26
27ok( $response = request('http://localhost/attributes/foo'),
28 "get /attributes/foo" );
0b0aee67 29ok_actions($response => ['foo']);
30
31ok( $response = request('http://localhost/attributes/all_attrs'),
32 "get /attributes/all_attrs" );
33ok( $response->is_success, "Response OK" );
34ok_actions($response => [qw/fetch all_attrs_action/]);
683d672b 35
0b0aee67 36ok( $response = request('http://localhost/attributes/some_attrs'),
37 "get /attributes/some_attrs" );
683d672b 38ok( $response->is_success, "Response OK" );
0b0aee67 39ok_actions($response => [qw/fetch some_attrs_action/]);
40
41ok( $response = request('http://localhost/attributes/one_attr'),
42 "get /attributes/one_attr" );
43ok( $response->is_success, "Response OK" );
44ok_actions($response => [qw/fetch one_attr_action/]);
45
46