X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_component_controller_action_chained.t;h=0a8d32dc6b975370bec2a4c4feaac7a66d39a729;hb=27c0dd050d10698bac29fa0dace3da7d818b7252;hp=46d95a98d6e7522f115367a7f31ede13875d1e3a;hpb=dbc702f6ef12c059c8645776e0762e4495c95715;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_component_controller_action_chained.t b/t/live_component_controller_action_chained.t index 46d95a9..0a8d32d 100644 --- a/t/live_component_controller_action_chained.t +++ b/t/live_component_controller_action_chained.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; } -use Test::More tests => 66*$iters; +use Test::More tests => 72*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -465,4 +465,43 @@ sub run_tests { $expected, 'Executed actions' ); is( $response->content, '1; 2, 3', 'Content OK' ); } + + # + # Test if :Chained is the same as :Chained('/') + # + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->rootdef + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/rootdef/23'), + ":Chained is the same as :Chained('/')" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '; 23', 'Content OK' ); + } + + # + # Test if :Chained('.') is working + # + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->parentchain + TestApp::Controller::Action::Chained::ParentChain->child + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/parentchain/1/child/2'), + ":Chained('.') chains to parent controller action" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '1; 2', 'Content OK' ); + } }