- Fix go / visit expecting captures and arguments in reverse order.
Gareth Kirwan [Mon, 21 Sep 2009 14:05:17 +0000 (14:05 +0000)]
Changes
lib/Catalyst/Dispatcher.pm
t/aggregate/live_component_controller_action_go.t
t/aggregate/live_component_controller_action_visit.t

diff --git a/Changes b/Changes
index 479164f..3ad01ee 100644 (file)
--- a/Changes
+++ b/Changes
@@ -10,6 +10,7 @@
        method.
      - Require new Moose version and new versions of various dependencies
        to avoid warnings from newest Moose release.
+     - Fix go / visit expecting captures and arguments in reverse order.
 
   Documentation:
      - Rework the $c->go documentation to make it more clear.
index 3d6573b..93c0d93 100644 (file)
@@ -131,7 +131,7 @@ sub _command2action {
     my (@args, @captures);
 
     if ( ref( $extra_params[-2] ) eq 'ARRAY' ) {
-        @captures = @{ pop @extra_params };
+        @captures = @{ splice @extra_params, -2, 1 };
     }
 
     if ( ref( $extra_params[-1] ) eq 'ARRAY' ) {
index 41b09b6..8554f72 100644 (file)
@@ -262,7 +262,7 @@ sub run_tests {
         ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
         is( $response->header('X-Catalyst-Executed'),
             $expected, 'Executed actions' );
-        is( $response->content, 'arg1, arg2; captureme', 'Content OK' );
+        is( $response->content, 'captureme; arg1, arg2', 'Content OK' );
     }
 
 }
index 4bd246d..b331e7c 100644 (file)
@@ -276,7 +276,7 @@ sub run_tests {
                 "visit to chained + subcontroller endpoint for $i" );
             is( $response->header('X-Catalyst-Executed'),
                 $expected, "Executed actions for $i" );
-            is( $response->content, "arg1, arg2; becomescapture",
+            is( $response->content, "becomescapture; arg1, arg2",
                 "Content OK for $i" );
         }
     }