test + fix from ted
Matt S Trout [Fri, 21 Apr 2006 19:54:00 +0000 (19:54 +0000)]
Changes
SubRequest.pm
t/02subreq.t
t/lib/TestApp.pm

diff --git a/Changes b/Changes
index a073656..fb8dd3a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 Revision history for Perl extension Catalyst::Plugin::SubRequest
 
+0.11  2006-04-21 14:13:00
+        - $c->req->params restored after sub_request
 0.10  2005-12-08 13:15:00  
         - Updated test suite to work with new catalyst.
 0.09  2005-10-28 01:07:00 
index d22cb78..563dd1f 100644 (file)
@@ -2,7 +2,7 @@ package Catalyst::Plugin::SubRequest;
 
 use strict;
 
-our $VERSION = '0.09';
+our $VERSION = '0.11';
 
 =head1 NAME
 
@@ -45,7 +45,7 @@ sub sub_request {
     local $c->req->{arguments} = $c->req->{arguments};
     local $c->req->{action};
     local $c->req->{path};
-    local $c->req->{params};
+    local $c->req->{parameters};
 
     $c->req->path($path);
     $c->req->params($params || {});
index b5bf145..b2ab017 100644 (file)
@@ -1,6 +1,6 @@
 package main;
 
-use Test::More tests => 6;
+use Test::More tests => 9;
 use lib 't/lib';
 use Catalyst::Test 'TestApp';
 use File::stat;
@@ -21,3 +21,8 @@ my $stat = stat($0);
     is( $response->content, '11433',    'Normal request content', );
 }
 
+{
+    ok( my $response = request('/subtest_params?value=abc'), 'Params Sub Request' );
+    is( $response->code, 200, 'OK status code' );
+    is( $response->content, '1abc3', 'Normal request content' );
+}
\ No newline at end of file
index 139905e..fe4b490 100644 (file)
@@ -25,6 +25,14 @@ __PACKAGE__->setup();
         $c->res->body($c->res->body().$arg);
     }
     
+    sub subtest_params : Global {
+        my ( $self, $c ) = @_;
+        my $before = $c->req->params->{value};
+        my $subreq = $c->subreq('/normal/2');
+        my $after = $c->req->params->{value};
+        $c->res->body($c->res->body().$after);
+    }
+
     sub end : Private {
         my ( $self, $c ) = @_;
         $c->res->body($c->res->body().'3');