X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_chained.t;h=79778752992252091c884bdd2dcde3867e34edf0;hb=439bc59c795c896db3b43daaff4e10c3f9741b1a;hp=53dca926fcca82efbf0a3f56f4549bd788f15c3b;hpb=9b7d26c74ea27e325f462a1f0e629a23809a4b8d;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 53dca92..7977875 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -908,6 +908,51 @@ sub run_tests { is( $response->content => 'a; anchor.html', 'Content OK' ); } + # CaptureArgs(1) PathPart('...') should win over CaptureArgs(2) PathPart('') + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained::CaptureArgs->base + TestApp::Controller::Action::Chained::CaptureArgs->one_arg + TestApp::Controller::Action::Chained::CaptureArgs->edit_one_arg + TestApp::Controller::Action::Chained::CaptureArgs->end + ]; + + my $expected = join( ", ", @expected ); + + # should dispatch to /base/one_args/edit_one_arg + ok( my $response = request('http://localhost/captureargs/one/edit'), + 'Correct arg order ran' ); + TODO: { + local $TODO = 'Known bug'; + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, 'base; one_arg; edit_one_arg', 'Content OK' ); + } + } + + # PathPart('...') Args(1) should win over CaptureArgs(2) PathPart('') + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained::CaptureArgs->base + TestApp::Controller::Action::Chained::CaptureArgs->test_one_arg + TestApp::Controller::Action::Chained::CaptureArgs->end + ]; + + my $expected = join( ", ", @expected ); + + # should dispatch to /base/test_one_arg + ok( my $response = request('http://localhost/captureargs/test/one'), + 'Correct pathpart/arg ran' ); + TODO: { + local $TODO = 'Known bug'; + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, 'base; test_plus_arg; one;', 'Content OK' ); + } + } + # # Args(0) should win over Args() if we actually have no arguments. { @@ -1029,6 +1074,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]; @@ -1040,7 +1086,8 @@ 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"); } }