add tests which prove the current behavior of not decoding chained args but decoding...
Rafael Kitover [Tue, 26 May 2009 15:02:53 +0000 (15:02 +0000)]
t/aggregate/live_component_controller_action_chained.t
t/aggregate/live_component_controller_action_local.t
t/lib/TestApp/Controller/Action/Chained.pm
t/lib/TestApp/Controller/Action/Local.pm

index 74db1f2..70b539d 100644 (file)
@@ -10,7 +10,7 @@ our $iters;
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 143*$iters;
+use Test::More tests => 145*$iters;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -1004,4 +1004,12 @@ sub run_tests {
                 $expected, 'Executed actions' );
         }
     }
+
+    {
+        ok( my $content =
+            get('http://localhost/chained/return_arg/foo%2Fbar%3B'),
+            'request with URI-encoded arg' );
+        # this is the CURRENT behavior
+        like( $content, qr{foo%2Fbar%3B\z}, 'args NOT decoded' );
+    }
 }
index ae98831..24fc2e4 100644 (file)
@@ -10,7 +10,7 @@ our $iters;
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 32*$iters;
+use Test::More tests => 34*$iters;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -135,4 +135,11 @@ sub run_tests {
             "Parameters don't split on %2F"
         );
     }
+
+    {
+        ok( my $content = get('http://locahost/action/local/five/foo%2Fbar%3B'),
+            'request with URI-encoded arg');
+        # this is the CURRENT behavior
+        like( $content, qr{'foo/bar;'}, 'args for Local actions URI-decoded' );
+    }
 }
index 0efdcca..c3c85fe 100644 (file)
@@ -195,6 +195,8 @@ sub view : Chained('/') PathPart('chained') CaptureArgs(1) {}
 sub star_search : Chained('view') PathPart('search') Args(0) { }
 sub doc_star : Chained('/') PathPart('chained/doc') Args(1) {}
 
+sub return_arg : Chained('/') PathPart('chained/return_arg') Args(1) {}
+
 sub end :Private {
   my ($self, $c) = @_;
   return if $c->stash->{no_end};
index 9d30cf2..d1672a0 100644 (file)
@@ -23,4 +23,9 @@ sub four : Action Path('four/five/six') {
     $c->forward('TestApp::View::Dump::Request');
 }
 
+sub five : Action Local Args(1) {
+    my ( $self, $c ) = @_;
+    $c->forward('TestApp::View::Dump::Request');
+}
+
 1;