[Catalyst-commits] r8197 - in Catalyst-Runtime/5.70/trunk: lib/Catalyst t

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Fri Aug 8 15:08:13 BST 2008


Author: bricas
Date: 2008-08-08 15:08:12 +0100 (Fri, 08 Aug 2008)
New Revision: 8197

Modified:
   Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm
   Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t
Log:
go() cannot dispatch to anon. actions, fix code and tests to match.

Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm	2008-08-07 16:31:31 UTC (rev 8196)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Dispatcher.pm	2008-08-08 14:08:12 UTC (rev 8197)
@@ -176,7 +176,7 @@
     my ( $c, $command ) = @_;
     my ( $action, $args ) = $self->_command2action(@_);
 
-    unless ($action) {
+    unless ($action && defined $action->namespace) {
         my $error =
             qq/Couldn't go to command "$command": /
           . qq/Invalid action or component./;

Modified: Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t	2008-08-07 16:31:31 UTC (rev 8196)
+++ Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_go.t	2008-08-08 14:08:12 UTC (rev 8197)
@@ -25,6 +25,16 @@
 
 sub run_tests {
     {
+        # Test go to global private action
+        ok( my $response = request('http://localhost/action/go/global'),
+            'Request' );
+        ok( $response->is_success, 'Response Successful 2xx' );
+        is( $response->content_type, 'text/plain', 'Response Content-Type' );
+        is( $response->header('X-Catalyst-Action'),
+            'action/go/global', 'Main Class Action' );
+    }
+
+    {
         my @expected = qw[
           TestApp::Controller::Action::Go->one
           TestApp::Controller::Action::Go->two
@@ -38,16 +48,8 @@
         @expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
         my $expected = join( ", ", @expected );
 
-        # Test go to global private action
-        ok( my $response = request('http://localhost/action/go/global'),
-            'Request' );
-        ok( $response->is_success, 'Response Successful 2xx' );
-        is( $response->content_type, 'text/plain', 'Response Content-Type' );
-        is( $response->header('X-Catalyst-Action'),
-            'action/go/global', 'Main Class Action' );
-
         # Test go to chain of actions.
-        ok( $response = request('http://localhost/action/go/one'),
+        ok( my $response = request('http://localhost/action/go/one'),
             'Request' );
         ok( $response->is_success, 'Response Successful 2xx' );
         is( $response->content_type, 'text/plain', 'Response Content-Type' );
@@ -211,16 +213,15 @@
         );
     }
 
-    # test class go 
+    # test class go -- MUST FAIL!
     {
         ok(
             my $response = request(
                 'http://localhost/action/go/class_go_test_action'),
             'Request'
         );
-        ok( $response->is_success, 'Response Successful 2xx' );
-        is( $response->header('X-Class-Go-Test-Method'), 1,
-            'Test Method' );
+        ok( !$response->is_success, 'Response Fails' );
+        is( $response->content, q(FATAL ERROR: Couldn't go to command "TestApp": Invalid action or component.), 'Error message' );
     }
 
     {




More information about the Catalyst-commits mailing list