aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-12-28 21:04:44 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-12-28 21:04:44 +0000
commitf9f84d9f6dea72cae4fc8e31448df408caccbd59 (patch)
treee3e5b7928e2b143c0d0140314c961249ec7a1cce /actionpack/test/controller/routing_test.rb
parent5cf118b1384bce266c76d3f4a12e761bbcb130ab (diff)
downloadrails-f9f84d9f6dea72cae4fc8e31448df408caccbd59.tar.gz
rails-f9f84d9f6dea72cae4fc8e31448df408caccbd59.tar.bz2
rails-f9f84d9f6dea72cae4fc8e31448df408caccbd59.zip
Routing uses URI escaping for path components and CGI escaping for query parameters.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5803 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 43397dee35..ced8ca2dc6 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -207,8 +207,15 @@ class LegacyRouteSetTests < Test::Unit::TestCase
map.path 'file/*path', :controller => 'content', :action => 'show_file'
map.connect ':controller/:action/:id'
end
+
+ # No + to space in URI escaping, only for query params.
results = rs.recognize_path "/file/hello+world/how+are+you%3F"
assert results, "Recognition should have succeeded"
+ assert_equal ['hello+world', 'how+are+you?'], results[:path]
+
+ # Use %20 for space instead.
+ results = rs.recognize_path "/file/hello%20world/how%20are%20you%3F"
+ assert results, "Recognition should have succeeded"
assert_equal ['hello world', 'how are you?'], results[:path]
results = rs.recognize_path "/file"
@@ -1457,11 +1464,11 @@ class RouteSetTest < Test::Unit::TestCase
def test_recognize_with_encoded_id_and_regex
set.draw do |map|
- map.connect 'page/:id', :controller => 'pages', :action => 'show', :id => /[a-zA-Z0-9 ]+/
+ map.connect 'page/:id', :controller => 'pages', :action => 'show', :id => /[a-zA-Z0-9\+]+/
end
assert_equal({:controller => 'pages', :action => 'show', :id => '10'}, set.recognize_path('/page/10'))
- assert_equal({:controller => 'pages', :action => 'show', :id => 'hello world'}, set.recognize_path('/page/hello+world'))
+ assert_equal({:controller => 'pages', :action => 'show', :id => 'hello+world'}, set.recognize_path('/page/hello+world'))
end
def test_recognize_with_conditions