X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_go.t;h=8554f724f2857cb66bc4a7ae9f768dceb8333974;hb=ed7e95f2d3f172591a3f45bc8f243a4ff511f775;hp=7f93369dc78ce77847f1f16c02184120dfa4a95f;hpb=42da66a91b0a87ebb81d8552bcd0b05d3557c83e;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_component_controller_action_go.t b/t/aggregate/live_component_controller_action_go.t index 7f93369..8554f72 100644 --- a/t/aggregate/live_component_controller_action_go.t +++ b/t/aggregate/live_component_controller_action_go.t @@ -10,7 +10,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 +43,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 +74,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 +96,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 +123,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 +133,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 +144,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 +154,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 +165,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 +200,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 +241,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 +262,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' ); } }