From: Andy Grundman Date: Sat, 22 Oct 2005 13:54:08 +0000 (+0000) Subject: Added a first-level controller index test, that passes X-Git-Tag: 5.7099_04~1130 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=a83a539831495b396c7f3eb1a4e5ac278cfc8fec Added a first-level controller index test, that passes --- diff --git a/t/live/component/controller/action/index.t b/t/live/component/controller/action/index.t index 738e422..35c397a 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 => 10; +use Test::More tests => 14; use Catalyst::Test 'TestApp'; for ( 1 .. 1 ) { @@ -19,13 +19,22 @@ for ( 1 .. 1 ) { is( $response->content, 'root index', 'root index no slash ok' ); } - # test controller index + # test first-level controller index { - ok( my $response = request('http://localhost/action/index/'), 'controller index' ); - is( $response->content, 'Action::Index index', 'controller index ok' ); + ok( my $response = request('http://localhost/action/'), 'first-level controller index' ); + is( $response->content, 'Action index', 'first-level controller index ok' ); - ok( $response = request('http://localhost/action/index'), 'controller index no slash' ); - is( $response->content, 'Action::Index index', 'controller index no slash ok' ); + ok( $response = request('http://localhost/action'), 'first-level controller index no slash' ); + is( $response->content, 'Action index', 'first-level controller index no slash ok' ); + } + + # test second-level controller index + { + ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' ); + 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->content, 'Action::Index index', 'second-level controller index no slash ok' ); } # test controller default when index is present diff --git a/t/live/lib/TestApp/Controller/Action.pm b/t/live/lib/TestApp/Controller/Action.pm index acd8385..3352415 100644 --- a/t/live/lib/TestApp/Controller/Action.pm +++ b/t/live/lib/TestApp/Controller/Action.pm @@ -9,6 +9,11 @@ sub begin : Private { $c->response->content_type('text/plain; charset=utf-8'); } +sub index : Private { + my ( $self, $c ) = @_; + $c->res->body( 'Action index' ); +} + sub default : Private { my ( $self, $c ) = @_; $c->res->output("Error - TestApp::Controller::Action\n");