X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Flive_component_controller_action_childof.t;h=712d03320dc43897457d2026434b5fb86945fd3d;hp=8ae78d2df336e3ad63a0acc88238d21f31a73cd5;hb=9cc849968f79904d340abec75ebd6706746973b6;hpb=09461385e3f0f62cbf3a95a71d00f71e1a42ca75 diff --git a/t/live_component_controller_action_childof.t b/t/live_component_controller_action_childof.t index 8ae78d2..712d033 100644 --- a/t/live_component_controller_action_childof.t +++ b/t/live_component_controller_action_childof.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; } -use Test::More tests => 60*$iters; +use Test::More tests => 66*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -425,4 +425,44 @@ sub run_tests { $expected, 'Executed actions' ); is( $response->content, '; 1, 2, 3', 'Content OK' ); } + + # + # Tests for optional PathPart attribute. + # + { + my @expected = qw[ + TestApp::Controller::Action::ChildOf->begin + TestApp::Controller::Action::ChildOf->opt_pp_start + TestApp::Controller::Action::ChildOf->opt_pathpart + TestApp::Controller::Action::ChildOf->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/childof/optpp/1/opt_pathpart/2'), + 'Optional :PathName attribute working' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '1; 2', 'Content OK' ); + } + + # + # Tests for optional PathPart *and* Args attributes. + # + { + my @expected = qw[ + TestApp::Controller::Action::ChildOf->begin + TestApp::Controller::Action::ChildOf->opt_all_start + TestApp::Controller::Action::ChildOf->oa + TestApp::Controller::Action::ChildOf->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/childof/optall/1/oa/2/3'), + 'Optional :PathName *and* :Args attributes working' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '1; 2, 3', 'Content OK' ); + } }