aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-06-05 14:51:27 +0000
committerJamis Buck <jamis@37signals.com>2006-06-05 14:51:27 +0000
commit2ffc84d23ff8f78bf43b277d64a4bcda51e932fc (patch)
tree83deb19800270a95aa41ad6a5ede5e66bdc1b4a3 /actionpack/test/controller/routing_test.rb
parent332fcfaf6bee6b3ae0911e9bbe24ded9af757868 (diff)
downloadrails-2ffc84d23ff8f78bf43b277d64a4bcda51e932fc.tar.gz
rails-2ffc84d23ff8f78bf43b277d64a4bcda51e932fc.tar.bz2
rails-2ffc84d23ff8f78bf43b277d64a4bcda51e932fc.zip
Make sure :id and friends are properly unescaped (closes #5275).
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4435 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 6388c6af03..acbf226a8c 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -241,6 +241,23 @@ class LegacyRouteSetTests < Test::Unit::TestCase
assert_equal({:controller => "content", :action => 'show_page', :id => '10'}, rs.recognize_path("/page/10"))
end
+ # For newer revision
+ def test_route_with_text_default
+ rs.draw do |map|
+ map.connect 'page/:id', :controller => 'content', :action => 'show_page', :id => 1
+ map.connect ':controller/:action/:id'
+ end
+
+ assert_equal '/page/foo', rs.generate(:controller => 'content', :action => 'show_page', :id => 'foo')
+ assert_equal({:controller => "content", :action => 'show_page', :id => 'foo'}, rs.recognize_path("/page/foo"))
+
+ token = "\321\202\320\265\320\272\321\201\321\202" # 'text' in russian
+ escaped_token = CGI::escape(token)
+
+ assert_equal '/page/' + escaped_token, rs.generate(:controller => 'content', :action => 'show_page', :id => token)
+ assert_equal({:controller => "content", :action => 'show_page', :id => token}, rs.recognize_path("/page/#{escaped_token}"))
+ end
+
def test_action_expiry
assert_equal '/content', rs.generate({:controller => 'content'}, {:controller => 'content', :action => 'show'})
end