Add chained go tests
Marcus Ramberg [Fri, 25 Jul 2008 06:56:31 +0000 (06:56 +0000)]
t/lib/TestApp/Controller/Action/Go.pm
t/live_component_controller_action_go.t

index 9ad2ae2..0b12a60 100644 (file)
@@ -61,6 +61,11 @@ sub go_die : Local {
     die $Catalyst::GO;
 }
 
+sub go_chained : Local {
+    my ( $self, $c, $val ) = @_;
+    $c->go('/action/chained/foo/spoon',[1]);
+}
+
 sub args_embed_relative : Local {
     my ( $self, $c ) = @_;
     $c->go('embed/ok');
index ac0112d..6f1f42e 100644 (file)
@@ -10,7 +10,7 @@ our $iters;
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 47 * $iters;
+use Test::More tests => 50 * $iters;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -223,8 +223,28 @@ sub run_tests {
             'Test Method' );
     }
 
+    {
+        my @expected = qw[
+          TestApp::Controller::Action::Go->begin
+          TestApp::Controller::Action::Go->go_chained
+          TestApp::Controller::Action::Chained->begin
+          TestApp::Controller::Action::Chained->foo
+          TestApp::Controller::Action::Chained::Foo->spoon
+          TestApp::Controller::Action::Chained->end
+        ];
+
+        my $expected = join( ", ", @expected );
+
+        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, '; 1', 'Content OK' );
+    }
+
 }
 
+
+
 sub _begin {
     local $_ = shift;
     s/->(.*)$/->begin/;