From: Gerda Shank Date: Wed, 2 Dec 2009 21:52:21 +0000 (+0000) Subject: add another failing test for Chained CaptureArgs preference X-Git-Tag: 5.80016~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=1c24a6c4837db21c388b8bd95beb87dc85b9e548;hp=37c2f09c644a515035a4ed519bf227c0137ac6f2 add another failing test for Chained CaptureArgs preference --- diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index 8a6a449..fef26ef 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -931,6 +931,28 @@ sub run_tests { } } + # 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. { diff --git a/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm b/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm index fb8320e..d42ab67 100644 --- a/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm +++ b/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm @@ -5,15 +5,16 @@ use strict; use base qw( Catalyst::Controller ); # -# This controller builds two patterns of URI: +# This controller build the following patterns of URI: # /captureargs/*/* # /captureargs/*/*/edit # /captureargs/* # /captureargs/*/edit +# /captureargs/test/* # It will output the arguments they got passed to @_ after the # context object. -# /captureargs/one/edit should not dispatch to -# /captureargs/*/* +# /captureargs/one/edit should not dispatch to /captureargs/*/* +# /captureargs/test/one should not dispatch to /captureargs/*/* sub base :Chained('/') PathPart('captureargs') CaptureArgs(0) { my ( $self, $c, $arg ) = @_; @@ -50,6 +51,11 @@ sub view_one_arg :Chained('one_arg') PathPart('') Args(0) { push @{ $c->stash->{ passed_args } }, 'view_one_arg'; } +sub test_plus_arg :Chained('base') PathPart('test') Args(1) { + my ( $self, $c, $arg ) = @_; + push @{ $c->stash->{ passed_args } }, 'test_plus_arg', $arg; +} + sub end : Private { my ( $self, $c ) = @_;