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_action.t;h=41e2b165c503184d657b3dfc4271f30dc4e1bc2e;hp=1e11b186f4ccb21b6fe0e71c785d9eb20e84d7f2;hb=7064f69b1dfb59d1f3bad647b2097d0320acce8a;hpb=5d8129e9b7bea385dd6fda9b490e7923f61eedd0 diff --git a/t/aggregate/live_component_controller_action_action.t b/t/aggregate/live_component_controller_action_action.t index 1e11b18..41e2b16 100644 --- a/t/aggregate/live_component_controller_action_action.t +++ b/t/aggregate/live_component_controller_action_action.t @@ -1,5 +1,3 @@ -#!perl - use strict; use warnings; @@ -10,7 +8,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 42 * $iters; +use Test::More; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -106,7 +104,7 @@ sub run_tests { 'Content is a serialized Catalyst::Request' ); } - + { ok( my $response = request('http://localhost/action_action_five'), 'Request' ); @@ -126,7 +124,6 @@ sub run_tests { 'Content is a serialized Catalyst::Request' ); } - { ok( my $response = request('http://localhost/action_action_six'), @@ -148,4 +145,71 @@ sub run_tests { ); } + { + ok( my $response = request('http://localhost/action_action_seven'), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), + 'action_action_seven', 'Test Action' ); + is( + $response->header('X-Test-Class'), + 'TestApp::Controller::Action::Action', + 'Test Class' + ); + is( $response->header('X-TestExtraArgsAction'), '42,23', 'Extra args get passed to action contstructor' ); + like( + $response->content, + qr/^bless\( .* 'Catalyst::Request' \)$/s, + 'Content is a serialized Catalyst::Request' + ); + } + + { + ok( my $response = request('http://localhost/action_action_eight'), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), + 'action_action_eight', 'Test Action' ); + is( + $response->header('X-Test-Class'), + 'TestApp::Controller::Action::Action', + 'Test Class' + ); + like( + $response->content, + qr/^bless\( .* 'Catalyst::Action' \)$/s, + 'Content is a serialized Catalyst::Action' + ); + + require Catalyst::Action; # when running against a remote server, we + # need to load the class in the test process + # to be able to introspect the action instance + # later. + my $action = eval $response->content; + is_deeply $action->attributes->{extra_attribute}, [13]; + is_deeply $action->attributes->{another_extra_attribute}, ['foo']; + } + { + ok( my $response = request('http://localhost/action_action_nine'), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), + 'action_action_nine', 'Test Action' ); + is( + $response->header('X-Test-Class'), + 'TestApp::Controller::Action::Action', + 'Test Class' + ); + is( $response->header('X-TestExtraArgsAction'), '42,13', 'Extra args get passed to action constructor' ); + like( + $response->content, + qr/^bless\( .* 'Catalyst::Request' \)$/s, + 'Content is a serialized Catalyst::Request' + ); + } } + +done_testing;