Permalink
Browse files

Test Hash#to_param escapes keys and values

  • Loading branch information...
1 parent 5c85822 commit 6cbd085f692aae7518ac67380e805ebb65896951 @spastorino spastorino committed with tenderlove Jul 21, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 activesupport/test/core_ext/hash_ext_test.rb
@@ -472,6 +472,10 @@ def test_number_hash
def test_to_param_hash
assert_equal 'custom=param-1&custom2=param2-1', ActiveSupport::OrderedHash[ToParam.new('custom'), ToParam.new('param'), ToParam.new('custom2'), ToParam.new('param2')].to_param
end
+
+ def test_to_param_hash_escapes_its_keys_and_values
+ assert_equal 'param+1=A+string+with+%2F+characters+%26+that+should+be+%3F+escaped', { 'param 1' => 'A string with / characters & that should be ? escaped' }.to_param
+ end
end
class HashToXmlTest < Test::Unit::TestCase

0 comments on commit 6cbd085

Please sign in to comment.