From: Marcus Ramberg Date: Fri, 25 Jul 2008 06:56:31 +0000 (+0000) Subject: Add chained go tests X-Git-Tag: 5.7099_04~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=be7ce1dcadffa68bbd99efb2366cfe1712dd678f Add chained go tests --- diff --git a/t/lib/TestApp/Controller/Action/Go.pm b/t/lib/TestApp/Controller/Action/Go.pm index 9ad2ae2..0b12a60 100644 --- a/t/lib/TestApp/Controller/Action/Go.pm +++ b/t/lib/TestApp/Controller/Action/Go.pm @@ -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'); diff --git a/t/live_component_controller_action_go.t b/t/live_component_controller_action_go.t index ac0112d..6f1f42e 100644 --- a/t/live_component_controller_action_go.t +++ b/t/live_component_controller_action_go.t @@ -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/;