From: Matt S Trout Date: Mon, 18 Aug 2008 12:02:54 +0000 (+0000) Subject: merge rafl's test X-Git-Tag: 5.7099_04~28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=69e7f14788b27841bc9573491b5afc7e2dc9a351 merge rafl's test --- diff --git a/t/lib/TestApp/Controller/Action/Chained.pm b/t/lib/TestApp/Controller/Action/Chained.pm index 61210dc..90b1efe 100644 --- a/t/lib/TestApp/Controller/Action/Chained.pm +++ b/t/lib/TestApp/Controller/Action/Chained.pm @@ -175,6 +175,16 @@ sub cc_b : Chained('cc_base') PathPart('b') CaptureArgs(0) { } sub cc_b_link : Chained('cc_b') PathPart('') CaptureArgs(1) { } sub cc_b_anchor : Chained('cc_b_link') PathPart('anchor.html') Args() { } +# +# Test static paths vs. captures +# + +sub apan : Chained('/') CaptureArgs(0) PathPrefix { } +sub korv : Chained('apan') CaptureArgs(0) PathPart('') { } +sub wurst : Chained('apan') CaptureArgs(1) PathPart('') { } +sub static_end : Chained('korv') Args(0) { } +sub capture_end : Chained('wurst') Args(0) PathPart('') { } + sub end :Private { my ($self, $c) = @_; return if $c->stash->{no_end}; diff --git a/t/live_component_controller_action_chained.t b/t/live_component_controller_action_chained.t index d2bf107..e2fed7d 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} || 1; } -use Test::More tests => 136*$iters; +use Test::More tests => 138*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -945,4 +945,23 @@ sub run_tests { is( $response->content, '; 1', 'Content OK' ); } + # + # static paths vs. captures + # + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->apan + TestApp::Controller::Action::Chained->korv + TestApp::Controller::Action::Chained->static_end + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/action/chained/static_end'), + "static paths are prefered over captures" ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + } }