[Catalyst-commits] r14306 - in trunk/Catalyst-Plugin-SubRequest/t: . lib/TestApp/Controller

nebulous at dev.catalyst.perl.org nebulous at dev.catalyst.perl.org
Thu Jun 14 19:41:17 GMT 2012


Author: nebulous
Date: 2012-06-14 19:41:17 +0000 (Thu, 14 Jun 2012)
New Revision: 14306

Modified:
   trunk/Catalyst-Plugin-SubRequest/t/02subreq.t
   trunk/Catalyst-Plugin-SubRequest/t/lib/TestApp/Controller/Root.pm
Log:
A test for $c->req smashing


Modified: trunk/Catalyst-Plugin-SubRequest/t/02subreq.t
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/t/02subreq.t	2012-06-11 16:01:29 UTC (rev 14305)
+++ trunk/Catalyst-Plugin-SubRequest/t/02subreq.t	2012-06-14 19:41:17 UTC (rev 14306)
@@ -1,6 +1,6 @@
 package main;
 
-use Test::More tests => 12;
+use Test::More tests => 15;
 use lib 't/lib';
 use Catalyst::Test 'TestApp';
 use File::stat;
@@ -27,6 +27,12 @@
 }
 
 {
+    ok( my $response = request('/subtest_req'), 'Sub request not stomping original request object' );
+    is( $response->code, 200, 'OK status code' );
+    is( $response->content, '/subtest_req', 'Normal request content' );
+}
+
+{
     ok( my $response = request('/subtest_full_response'),    'Sub Reuqest returning full response object'  );
     is( $response->code, 200,                 'OK status code'  );
     is( $response->content, '1text/csv3',    'Normal request content', );

Modified: trunk/Catalyst-Plugin-SubRequest/t/lib/TestApp/Controller/Root.pm
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/t/lib/TestApp/Controller/Root.pm	2012-06-11 16:01:29 UTC (rev 14305)
+++ trunk/Catalyst-Plugin-SubRequest/t/lib/TestApp/Controller/Root.pm	2012-06-14 19:41:17 UTC (rev 14306)
@@ -29,6 +29,13 @@
     $c->res->body($c->res->body().$after);
 }
 
+sub subtest_req : Global {
+    my ( $self, $c ) = @_;
+    my $subreq = $c->subreq('/normal/2');
+    my $after = $c->req->uri->path;
+    $c->res->body($after);
+}
+
 sub subtest_full_response : Global {
     my ( $self, $c ) = @_;
     my $subreq_res = $c->subreq_res('/typesetter');




More information about the Catalyst-commits mailing list