[Catalyst-commits] r8588 - in Catalyst-Runtime/5.80/trunk/t: aggregate lib/TestApp/Controller/Action

omega at dev.catalyst.perl.org omega at dev.catalyst.perl.org
Tue Nov 11 14:10:47 GMT 2008


Author: omega
Date: 2008-11-11 14:10:47 +0000 (Tue, 11 Nov 2008)
New Revision: 8588

Modified:
   Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t
   Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Chained.pm
Log:
Added a test for a chained bug

Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t	2008-11-11 11:57:18 UTC (rev 8587)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t	2008-11-11 14:10:47 UTC (rev 8588)
@@ -10,7 +10,7 @@
 
 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 @@
         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' );
+    }
 }

Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Chained.pm	2008-11-11 11:57:18 UTC (rev 8587)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Chained.pm	2008-11-11 14:10:47 UTC (rev 8588)
@@ -185,6 +185,12 @@
 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};




More information about the Catalyst-commits mailing list