From: Andy Grundman Date: Sat, 22 Oct 2005 13:49:06 +0000 (+0000) Subject: Added index tests, 2 are failing X-Git-Tag: 5.7099_04~1131 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=e0e47c71fdefb2f22ce618560c6546bade22ea53 Added index tests, 2 are failing --- diff --git a/t/live/component/controller/action/index.t b/t/live/component/controller/action/index.t new file mode 100644 index 0000000..738e422 --- /dev/null +++ b/t/live/component/controller/action/index.t @@ -0,0 +1,36 @@ +#!perl + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../../../lib"; + +use Test::More tests => 10; +use Catalyst::Test 'TestApp'; + +for ( 1 .. 1 ) { + # test root index + { + ok( my $response = request('http://localhost/'), 'root index' ); + is( $response->content, 'root index', 'root index ok' ); + + ok( $response = request('http://localhost'), 'root index no slash' ); + is( $response->content, 'root index', 'root index no slash ok' ); + } + + # test controller index + { + ok( my $response = request('http://localhost/action/index/'), 'controller index' ); + is( $response->content, 'Action::Index index', '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' ); + } + + # test controller default when index is present + { + ok( my $response = request('http://localhost/action/index/foo'), 'default with index' ); + is( $response->content, "Error - TestApp::Controller::Action\n", 'default with index ok' ); + } +} diff --git a/t/live/lib/TestApp.pm b/t/live/lib/TestApp.pm index 8227622..95d77e2 100644 --- a/t/live/lib/TestApp.pm +++ b/t/live/lib/TestApp.pm @@ -10,6 +10,11 @@ TestApp->config( name => 'TestApp', root => '/some/dir' ); TestApp->setup; +sub index : Private { + my ( $self, $c ) = @_; + $c->res->body( 'root index' ); +} + sub global_action : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); diff --git a/t/live/lib/TestApp/Controller/Action/Index.pm b/t/live/lib/TestApp/Controller/Action/Index.pm new file mode 100644 index 0000000..d6b2ada --- /dev/null +++ b/t/live/lib/TestApp/Controller/Action/Index.pm @@ -0,0 +1,11 @@ +package TestApp::Controller::Action::Index; + +use strict; +use base 'TestApp::Controller::Action'; + +sub index : Private { + my ( $self, $c ) = @_; + $c->res->body( 'Action::Index index' ); +} + +1;