diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2011-10-13 18:50:23 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2011-10-13 19:02:58 -0700 |
commit | 45ced7e1beb0d996f0471e21f0f88efaf2b26124 (patch) | |
tree | 58870f96bb75a4aeb2c8e3dc561a85f9925b0e6d /actionpack | |
parent | a5b0f914f16aac806a157dd4b6f3e3f3656d8396 (diff) | |
download | rails-45ced7e1beb0d996f0471e21f0f88efaf2b26124.tar.gz rails-45ced7e1beb0d996f0471e21f0f88efaf2b26124.tar.bz2 rails-45ced7e1beb0d996f0471e21f0f88efaf2b26124.zip |
Failing tests for path parameter escaping
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index a71ac1bdc1..a0d2c51a7c 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -2528,3 +2528,30 @@ class TestHttpMethods < ActionDispatch::IntegrationTest end end end + +class TestUriPathEscaping < ActionDispatch::IntegrationTest + Routes = ActionDispatch::Routing::RouteSet.new.tap do |app| + app.draw do + match '/:segment' => lambda { |env| + path_params = env['action_dispatch.request.path_parameters'] + [200, { 'Content-Type' => 'text/plain' }, [path_params[:segment]]] + }, :as => :segment + end + end + + include Routes.url_helpers + def app; Routes end + + setup do + @path, @param = '/a%20b%2Fc+d', 'a b/c+d' + end + + test 'escapes generated path parameters' do + assert_equal @path, segment_path(:segment => @param) + end + + test 'unescapes recognized path parameters' do + get @path + assert_equal @param, @response.body + end +end |