X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_component_controller_action_local.t;h=51771635f152c89fec6d475cdbba5fccf8e86f9c;hb=09461385e3f0f62cbf3a95a71d00f71e1a42ca75;hp=1d85bee412f91da1190f2203f90db6036f2f9a09;hpb=50cc3183118f1056427ab314b84b91fd0d9e1383;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_component_controller_action_local.t b/t/live_component_controller_action_local.t index 1d85bee..5177163 100644 --- a/t/live_component_controller_action_local.t +++ b/t/live_component_controller_action_local.t @@ -4,13 +4,13 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; } -use Test::More tests => 24*$iters; +use Test::More tests => 32*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -44,7 +44,7 @@ sub run_tests { } { - ok( my $response = request('http://localhost/action/local/two'), + ok( my $response = request('http://localhost/action/local/two/1/2'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); @@ -63,6 +63,12 @@ sub run_tests { } { + ok( my $response = request('http://localhost/action/local/two'), + 'Request' ); + ok( !$response->is_success, 'Request with wrong number of args failed' ); + } + + { ok( my $response = request('http://localhost/action/local/three'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); @@ -102,4 +108,26 @@ sub run_tests { 'Content is a serialized Catalyst::Request' ); } + + { + ok( + my $response = + request('http://localhost/action/local/one/foo%2Fbar'), + 'Request' + ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), + 'action/local/one', 'Test Action' ); + is( + $response->header('X-Test-Class'), + 'TestApp::Controller::Action::Local', + 'Test Class' + ); + like( + $response->content, + qr~arguments => \[\s*'foo/bar'\s*\]~, + "Parameters don't split on %2F" + ); + } }