7 use lib "$FindBin::Bin/../../../lib";
9 use Test::More tests => 19;
10 use Catalyst::Test 'TestApp';
15 ok( my $response = request('http://localhost/'), 'root index' );
16 is( $response->content, 'root index', 'root index ok' );
18 ok( $response = request('http://localhost'), 'root index no slash' );
19 is( $response->content, 'root index', 'root index no slash ok' );
22 # test first-level controller index
25 TestApp::Controller::Index->index
28 my $expected = join( ", ", @expected );
30 ok( my $response = request('http://localhost/index/'), 'first-level controller index' );
31 is( $response->header('X-Catalyst-Executed'),
32 $expected, 'Executed actions' );
33 is( $response->content, 'Index index', 'first-level controller index ok' );
35 ok( $response = request('http://localhost/index'), 'first-level controller index no slash' );
36 is( $response->header('X-Catalyst-Executed'),
37 $expected, 'Executed actions' );
38 is( $response->content, 'Index index', 'first-level controller index no slash ok' );
41 # test second-level controller index
44 TestApp::Controller::Action::Index->begin
45 TestApp::Controller::Action::Index->index
48 my $expected = join( ", ", @expected );
50 ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' );
51 is( $response->header('X-Catalyst-Executed'),
52 $expected, 'Executed actions' );
53 is( $response->content, 'Action-Index index', 'second-level controller index ok' );
55 ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' );
56 is( $response->header('X-Catalyst-Executed'),
57 $expected, 'Executed actions' );
58 is( $response->content, 'Action-Index index', 'second-level controller index no slash ok' );
61 # test controller default when index is present
64 TestApp::Controller::Action::Index->begin
65 TestApp::Controller::Action::Index->default
68 my $expected = join( ", ", @expected );
70 ok( my $response = request('http://localhost/action/index/foo'), 'default with index' );
71 is( $response->header('X-Catalyst-Executed'),
72 $expected, 'Executed actions' );
73 is( $response->content, "Error - TestApp::Controller::Action\n", 'default with index ok' );