From: Andy Grundman Date: Sat, 22 Oct 2005 15:22:44 +0000 (+0000) Subject: Added expected actions tests to index test X-Git-Tag: 5.7099_04~1127 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=bf60b99492003c9b94a96f7630d725ed6edb65ba Added expected actions tests to index test --- diff --git a/MANIFEST b/MANIFEST index c6c44de..6088c95 100644 --- a/MANIFEST +++ b/MANIFEST @@ -51,6 +51,7 @@ t/live/component/controller/action/detach.t t/live/component/controller/action/end.t t/live/component/controller/action/forward.t t/live/component/controller/action/global.t +t/live/component/controller/action/index.t t/live/component/controller/action/inheritance.t t/live/component/controller/action/local.t t/live/component/controller/action/multipath.t @@ -86,6 +87,7 @@ t/live/lib/TestApp/Controller/Action/Detach.pm t/live/lib/TestApp/Controller/Action/End.pm t/live/lib/TestApp/Controller/Action/Forward.pm t/live/lib/TestApp/Controller/Action/Global.pm +t/live/lib/TestApp/Controller/Action/Index.pm t/live/lib/TestApp/Controller/Action/Inheritance.pm t/live/lib/TestApp/Controller/Action/Local.pm t/live/lib/TestApp/Controller/Action/Multipath.pm @@ -102,6 +104,7 @@ t/live/lib/TestApp/Controller/Engine/Response/Headers.pm t/live/lib/TestApp/Controller/Engine/Response/Large.pm t/live/lib/TestApp/Controller/Engine/Response/Redirect.pm t/live/lib/TestApp/Controller/Engine/Response/Status.pm +t/live/lib/TestApp/Controller/Index.pm t/live/lib/TestApp/View/Dump.pm t/live/lib/TestApp/View/Dump/Parameters.pm t/live/lib/TestApp/View/Dump/Request.pm diff --git a/t/live/component/controller/action/index.t b/t/live/component/controller/action/index.t index 2233134..a18871b 100644 --- a/t/live/component/controller/action/index.t +++ b/t/live/component/controller/action/index.t @@ -6,7 +6,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/../../../lib"; -use Test::More tests => 14; +use Test::More tests => 19; use Catalyst::Test 'TestApp'; for ( 1 .. 1 ) { @@ -21,25 +21,55 @@ for ( 1 .. 1 ) { # test first-level controller index { + my @expected = qw[ + TestApp::Controller::Index->index + ]; + + my $expected = join( ", ", @expected ); + ok( my $response = request('http://localhost/index/'), 'first-level controller index' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); is( $response->content, 'Index index', 'first-level controller index ok' ); ok( $response = request('http://localhost/index'), 'first-level controller index no slash' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); is( $response->content, 'Index index', 'first-level controller index no slash ok' ); } # test second-level controller index { + my @expected = qw[ + TestApp::Controller::Action::Index->begin + TestApp::Controller::Action::Index->index + ]; + + my $expected = join( ", ", @expected ); + ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); is( $response->content, 'Action::Index index', 'second-level controller index ok' ); ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); is( $response->content, 'Action::Index index', 'second-level controller index no slash ok' ); } # test controller default when index is present { + my @expected = qw[ + TestApp::Controller::Action::Index->begin + TestApp::Controller::Action::Index->default + ]; + + my $expected = join( ", ", @expected ); + ok( my $response = request('http://localhost/action/index/foo'), 'default with index' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); is( $response->content, "Error - TestApp::Controller::Action\n", 'default with index ok' ); } }