X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_go.t;h=60f8bb8b94dce92006ce158f72e5416af0c8487c;hp=7f93369dc78ce77847f1f16c02184120dfa4a95f;hb=7064f69b1dfb59d1f3bad647b2097d0320acce8a;hpb=42da66a91b0a87ebb81d8552bcd0b05d3557c83e diff --git a/t/aggregate/live_component_controller_action_go.t b/t/aggregate/live_component_controller_action_go.t index 7f93369..60f8bb8 100644 --- a/t/aggregate/live_component_controller_action_go.t +++ b/t/aggregate/live_component_controller_action_go.t @@ -1,5 +1,3 @@ -#!perl - use strict; use warnings; @@ -10,7 +8,8 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 50 * $iters; +use Test::More tests => 54 * $iters; +use Catalyst; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -42,7 +41,7 @@ sub run_tests { TestApp::Controller::Action::Go->four TestApp::Controller::Action::Go->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -73,7 +72,7 @@ sub run_tests { my @expected = qw[ TestApp::Controller::Action::Go->go_die TestApp::Controller::Action::Go->args - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -95,7 +94,26 @@ sub run_tests { $expected, 'Executed actions' ); is( $response->content, $Catalyst::GO, "Go died as expected" ); } - + { + ok( + my $response = request('http://localhost/action/go/model'), + 'Request with args' + ); + is( $response->content, + q[FATAL ERROR: Couldn't go("Model::Foo"): Action cannot _DISPATCH. Did you try to go() a non-controller action?], + q[go('Model::...') test] + ); + } + { + ok( + my $response = request('http://localhost/action/go/view'), + 'Request with args' + ); + is( $response->content, + q[FATAL ERROR: Couldn't go("View::Dump"): Action cannot _DISPATCH. Did you try to go() a non-controller action?], + q[go('View::...') test] + ); + } { ok( my $response = @@ -103,7 +121,7 @@ sub run_tests { 'Request with args' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->content, 'old' ); + is( $response->content, 'old', 'go() with args (old)' ); } { @@ -113,7 +131,7 @@ sub run_tests { 'Request with args and method' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->content, 'new' ); + is( $response->content, 'new', 'go() with args (new)' ); } # test go with embedded args @@ -124,7 +142,7 @@ sub run_tests { 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->content, 'ok' ); + is( $response->content, 'ok', 'go() with args_embed_relative' ); } { @@ -134,7 +152,7 @@ sub run_tests { 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->content, 'ok' ); + is( $response->content, 'ok', 'go() with args_embed_absolute' ); } { my @expected = qw[ @@ -145,7 +163,7 @@ sub run_tests { TestApp::Controller::Action::Go->four TestApp::Controller::Action::Go->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -180,7 +198,7 @@ sub run_tests { TestApp::Controller::Action::Go->four TestApp::Controller::Action::Go->five TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected; @@ -221,7 +239,10 @@ sub run_tests { 'Request' ); ok( !$response->is_success, 'Response Fails' ); - is( $response->content, q(FATAL ERROR: Couldn't go to command "TestApp": Invalid action or component.), 'Error message' ); + is( $response->content, + q(FATAL ERROR: Couldn't go("TestApp"): Action has no namespace: cannot go() to a plain method or component, must be an :Action of some sort.), + 'Error message' + ); } { @@ -239,7 +260,7 @@ sub run_tests { ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); - is( $response->content, '; 1', 'Content OK' ); + is( $response->content, 'captureme; arg1, arg2', 'Content OK' ); } }