X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_chained.t;h=6f0181233912fd42eccdd102ce1f83f086dac425;hb=0b0aee670c39f8cb8f140eb62de9bfaf2c343a24;hp=fef26efb9fd6be7fb836f806ae59691926e5bd51;hpb=1c24a6c4837db21c388b8bd95beb87dc85b9e548;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index fef26ef..6f01812 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -847,6 +847,30 @@ sub run_tests { } # + # Complex path with multiple non-capturing pathparts + # PathPart('') CaptureArgs(0), PathPart('foo') CaptureArgs(0), PathPart('') Args(0) + # should win over PathPart('') CaptureArgs(1), PathPart('') Args(0) + # + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->mult_nopp2_base + TestApp::Controller::Action::Chained->mult_nopp2_nocap + TestApp::Controller::Action::Chained->mult_nopp2_action + TestApp::Controller::Action::Chained->mult_nopp2_action_default + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/mult_nopp2/action'), + "Complex path with multiple non-capturing pathparts" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '; ', 'Content OK' ); + } + + # # Higher Args() hiding more specific CaptureArgs chains sections # { @@ -1074,6 +1098,7 @@ sub run_tests { ['foo%2Fbar', 'baz%2Fquux'], ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}], ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}], + ['h%C3%BCtte', 'h%C3%BCtte', { test => 'h%C3%BCtte' } ], ) { my $path = '/chained/roundtrip_urifor/' . $thing->[0] . '/' . $thing->[1]; @@ -1085,7 +1110,21 @@ sub run_tests { 'request ' . $path . ' ok'); # Just check that the path matches, as who the hell knows or cares # where the app is based (live tests etc) - ok( index($content, $path) > 1, 'uri can round trip through uri_for' ); + ok( index($content, $path) > 1, 'uri can round trip through uri_for' ) + or diag("Expected $path, got $content"); + } + + # + # match_captures + # + { + + ok( my $response = request('http://localhost/chained/match_captures/foo/bar'), 'match_captures: falling through' ); + is($response->header('X-TestAppActionTestMatchCaptures'), 'fallthrough', 'match_captures: fell through'); + + ok($response = request('http://localhost/chained/match_captures/force/bar'), 'match_captures: *not* falling through' ); + is($response->header('X-TestAppActionTestMatchCaptures'), 'forcing', 'match_captures: forced'); + is($response->header('X-TestAppActionTestMatchCapturesHasRan'), 'yes', 'match_captures: actually ran'); } }