aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-05 23:42:43 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-05 23:42:43 -0200
commit88b064dfae924f28ec4750ea5a3a91b855481546 (patch)
tree90cb78b35547064e1bb2cb60ea588bd4093a4157
parent326e6527497126b2ea3627e377b6a4b5c9191bef (diff)
downloadrails-88b064dfae924f28ec4750ea5a3a91b855481546.tar.gz
rails-88b064dfae924f28ec4750ea5a3a91b855481546.tar.bz2
rails-88b064dfae924f28ec4750ea5a3a91b855481546.zip
Move test to the right file
-rw-r--r--activesupport/test/core_ext/object/to_param_test.rb11
-rw-r--r--activesupport/test/core_ext/object/to_query_test.rb9
2 files changed, 9 insertions, 11 deletions
diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb
index eae68ed184..bd7c6c422a 100644
--- a/activesupport/test/core_ext/object/to_param_test.rb
+++ b/activesupport/test/core_ext/object/to_param_test.rb
@@ -1,6 +1,5 @@
require 'abstract_unit'
require 'active_support/core_ext/object/to_param'
-require 'active_support/core_ext/object/to_query'
class ToParamTest < ActiveSupport::TestCase
def test_object
@@ -17,14 +16,4 @@ class ToParamTest < ActiveSupport::TestCase
assert_equal true, true.to_param
assert_equal false, false.to_param
end
-
- def test_nested_empty_hash
- hash1 = {a: 1, b: {c: 3, d: {}}}.to_param
- hash2 = {p: 12, b: {c: 3, e: nil, f: ''}}.to_param
- hash3 = {b: {c: 3, k: {}, f: '' }}.to_param
-
- assert_equal 'a=1&b[c]=3&b[d]=', CGI::unescape(hash1)
- assert_equal 'b[c]=3&b[e]=&b[f]=&p=12', CGI::unescape(hash2)
- assert_equal 'b[c]=3&b[f]=&b[k]=', CGI::unescape(hash3)
- end
end
diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb
index 92f996f9a4..a53d7781f9 100644
--- a/activesupport/test/core_ext/object/to_query_test.rb
+++ b/activesupport/test/core_ext/object/to_query_test.rb
@@ -46,6 +46,15 @@ class ToQueryTest < ActiveSupport::TestCase
:person => {:id => [20, 10]}
end
+ def test_nested_empty_hash
+ assert_query_equal 'a=1&b%5Bc%5D=3&b%5Bd%5D=',
+ { a: 1, b: { c: 3, d: {} } }
+ assert_query_equal 'b%5Bc%5D=3&b%5Be%5D=&b%5Bf%5D=&p=12',
+ { p: 12, b: { c: 3, e: nil, f: '' } }
+ assert_query_equal 'b%5Bc%5D=3&b%5Bf%5D=&b%5Bk%5D=',
+ { b: { c: 3, k: {}, f: '' } }
+ end
+
private
def assert_query_equal(expected, actual)
assert_equal expected.split('&'), actual.to_query.split('&')