From: Andreas Marienborg Date: Tue, 11 Nov 2008 14:10:47 +0000 (+0000) Subject: Added a test for a chained bug X-Git-Tag: 5.8000_03~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ef5e5ed10cc98a56dac32d905d7e7b9e30370e43 Added a test for a chained bug --- diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index a08c701..2e9c153 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 141*$iters; +use Test::More tests => 143*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -981,4 +981,24 @@ sub run_tests { is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); } + + # + # */search + # doc/* + # + # request for doc/search should end up in doc/* + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->doc_star + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/doc/search'), + "we prefer static path parts earlier in the chain" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + } } diff --git a/t/lib/TestApp/Controller/Action/Chained.pm b/t/lib/TestApp/Controller/Action/Chained.pm index 90b1efe..6acc378 100644 --- a/t/lib/TestApp/Controller/Action/Chained.pm +++ b/t/lib/TestApp/Controller/Action/Chained.pm @@ -185,6 +185,12 @@ sub wurst : Chained('apan') CaptureArgs(1) PathPart('') { } sub static_end : Chained('korv') Args(0) { } sub capture_end : Chained('wurst') Args(0) PathPart('') { } + +# */search vs doc/* +sub view : Chained('/') PathPart('chained') CaptureArgs(1) {} +sub star_search : Chained('view') PathPart('search') Args(0) { } +sub doc_star : Chained('/') PathPart('chained/doc') Args(1) {} + sub end :Private { my ($self, $c) = @_; return if $c->stash->{no_end};