From: Andy Grundman Date: Wed, 5 Oct 2005 02:01:50 +0000 (+0000) Subject: Static::Simple, added failing test for subrequest NEXT problem X-Git-Tag: v0.09~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-Static-Simple.git;a=commitdiff_plain;h=8223995544e9031e40cac6e1d06ffc1ac8d8a275 Static::Simple, added failing test for subrequest NEXT problem --- diff --git a/lib/Catalyst/Plugin/Static/Simple.pm b/lib/Catalyst/Plugin/Static/Simple.pm index 01abfa2..b83215b 100644 --- a/lib/Catalyst/Plugin/Static/Simple.pm +++ b/lib/Catalyst/Plugin/Static/Simple.pm @@ -46,7 +46,7 @@ sub prepare_action { return if ( $c->_locate_static_file ); } - return $c->NEXT::prepare_action(@_); + return $c->NEXT::ACTUAL::prepare_action(@_); } # dispatch takes the file found during prepare_action and serves it @@ -62,7 +62,7 @@ sub dispatch { return $c->_serve_static; } else { - return $c->NEXT::dispatch(@_); + return $c->NEXT::ACTUAL::dispatch(@_); } } @@ -96,7 +96,7 @@ sub finalize { return $c->finalize_headers; } - return $c->NEXT::finalize(@_); + return $c->NEXT::ACTUAL::finalize(@_); } sub setup { diff --git a/t/08subreq.t b/t/08subreq.t new file mode 100644 index 0000000..bd3f06c --- /dev/null +++ b/t/08subreq.t @@ -0,0 +1,20 @@ +#!perl + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/lib"; + +use Test::More tests => 2; +use Catalyst::Test 'TestApp'; + +SKIP: +{ + if ( ! TestApp->isa('Catalyst::Plugin::SubRequest') ) { + skip "Install the SubRequest plugin for these tests", 2; + } + + ok( my $res = request('http://localhost/subtest'), 'Request' ); + is( $res->content, 'subtest2 ok', 'SubRequest ok' ); +} diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index ff23ab8..a419d10 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -9,7 +9,13 @@ TestApp->config( name => 'TestApp', ); -TestApp->setup( qw/Static::Simple/ ); +my @plugins = qw/-Debug Static::Simple/; + +# load the SubRequest plugin if available +eval { require Catalyst::Plugin::SubRequest; }; +push @plugins, 'SubRequest' unless ($@); + +TestApp->setup( @plugins ); sub incpath_generator { my $c = shift; @@ -23,4 +29,16 @@ sub default : Private { $c->res->output( 'default' ); } +sub subtest : Local { + my ( $self, $c ) = @_; + + $c->res->output( $c->subreq('/subtest2') ); +} + +sub subtest2 : Local { + my ( $self, $c ) = @_; + + $c->res->output( 'subtest2 ok' ); +} + 1;