From: Andy Grundman Date: Wed, 12 Oct 2005 14:36:49 +0000 (+0000) Subject: Added failing tests for embedded forward X-Git-Tag: 5.7099_04~1218 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ab96c27ad9478fd4bb2734f6b9d1ee95acf190fb;hp=35bdf5eadf74c6edf4f6015b7f1c689c6092dcf4 Added failing tests for embedded forward --- diff --git a/t/live/component/controller/action/forward.t b/t/live/component/controller/action/forward.t index 58355af..a68f291 100644 --- a/t/live/component/controller/action/forward.t +++ b/t/live/component/controller/action/forward.t @@ -6,7 +6,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/../../../lib"; -use Test::More tests => 24; +use Test::More tests => 30; use Catalyst::Test 'TestApp'; @@ -68,11 +68,22 @@ use Catalyst::Test 'TestApp'; { ok( my $response = request('http://localhost/action/forward/with_args/old'), 'Request with args' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->content,'old'); + is( $response->content, 'old' ); } { ok( my $response = request('http://localhost/action/forward/with_method_and_args/old'), 'Request with args and method' ); ok( $response->is_success, 'Response Successful 2xx' ); - is( $response->content,'old'); + is( $response->content, 'old' ); +} + +# test forward with embedded args +{ + ok( my $response = request('http://localhost/action/forward/args_embed_relative'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content, 'ok' ); + + ok( my $response = request('http://localhost/action/forward/args_embed_absolute'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content, 'ok' ); } diff --git a/t/live/lib/TestApp/Controller/Action/Forward.pm b/t/live/lib/TestApp/Controller/Action/Forward.pm index b03eff9..02ce255 100644 --- a/t/live/lib/TestApp/Controller/Action/Forward.pm +++ b/t/live/lib/TestApp/Controller/Action/Forward.pm @@ -63,4 +63,21 @@ sub args : Local { die "passed argument does not match args" unless $val eq $c->req->args->[0]; } +sub args_embed_relative : Local { + my ( $self, $c ) = @_; + $c->forward( 'embed/ok' ); +} + +sub args_embed_absolute : Local { + my ( $self, $c ) = @_; + $c->forward( '/action/forward/embed/ok' ); +} + +sub embed : Local { + my ( $self, $c, $ok ) = @_; + + $ok ||= 'not ok'; + $c->res->body( $ok ); +} + 1;