7 use lib "$FindBin::Bin/../../../lib";
9 use Test::More tests => 18;
10 use Catalyst::Test 'TestApp';
12 # test auto + local method
15 TestApp::Controller::Action::Auto->begin
16 TestApp::Controller::Action::Auto->auto
17 TestApp::Controller::Action::Auto->one
20 my $expected = join( ", ", @expected );
22 ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
23 is( $response->header('X-Catalyst-Executed'),
24 $expected, 'Executed actions' );
25 is( $response->content, 'one', 'Content OK' );
31 TestApp::Controller::Action::Auto->begin
32 TestApp::Controller::Action::Auto->auto
33 TestApp::Controller::Action::Auto->default
36 my $expected = join( ", ", @expected );
38 ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' );
39 is( $response->header('X-Catalyst-Executed'),
40 $expected, 'Executed actions' );
41 is( $response->content, 'default', 'Content OK' );
44 # test auto + auto + local
47 TestApp::Controller::Action::Auto::Deep->begin
48 TestApp::Controller::Action::Auto->auto
49 TestApp::Controller::Action::Auto::Deep->auto
50 TestApp::Controller::Action::Auto::Deep->one
53 my $expected = join( ", ", @expected );
55 ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' );
56 is( $response->header('X-Catalyst-Executed'),
57 $expected, 'Executed actions' );
58 is( $response->content, 'deep one', 'Content OK' );
61 # test auto + auto + default
64 TestApp::Controller::Action::Auto::Deep->begin
65 TestApp::Controller::Action::Auto->auto
66 TestApp::Controller::Action::Auto::Deep->auto
67 TestApp::Controller::Action::Auto::Deep->default
70 my $expected = join( ", ", @expected );
72 ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' );
73 is( $response->header('X-Catalyst-Executed'),
74 $expected, 'Executed actions' );
75 is( $response->content, 'deep default', 'Content OK' );
78 # test auto + failing auto + local + end
81 TestApp::Controller::Action::Auto::Abort->begin
82 TestApp::Controller::Action::Auto->auto
83 TestApp::Controller::Action::Auto::Abort->auto
84 TestApp::Controller::Action::Auto::Abort->end
87 my $expected = join( ", ", @expected );
89 ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' );
90 is( $response->header('X-Catalyst-Executed'),
91 $expected, 'Executed actions' );
92 is( $response->content, 'abort end', 'Content OK' );
95 # test auto + failing auto + default + end
98 TestApp::Controller::Action::Auto::Abort->begin
99 TestApp::Controller::Action::Auto->auto
100 TestApp::Controller::Action::Auto::Abort->auto
101 TestApp::Controller::Action::Auto::Abort->end
104 my $expected = join( ", ", @expected );
106 ok( my $response = request('http://localhost/action/auto/abort/anything'), 'auto + failing auto + default' );
107 is( $response->header('X-Catalyst-Executed'),
108 $expected, 'Executed actions' );
109 is( $response->content, 'abort end', 'Content OK' );