diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2014-05-02 20:57:59 +0300 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2014-05-03 07:40:50 +0300 |
commit | 41bbac6ff4d161fc94ef2dc601e06f0a2779dbaf (patch) | |
tree | f96e9f1a9eceb039803c19ffde33eb5712e19c93 /activesupport/test/core_ext/object | |
parent | 4565cb7ccbd5f29a194c197c5ece9fb81f889d32 (diff) | |
download | rails-41bbac6ff4d161fc94ef2dc601e06f0a2779dbaf.tar.gz rails-41bbac6ff4d161fc94ef2dc601e06f0a2779dbaf.tar.bz2 rails-41bbac6ff4d161fc94ef2dc601e06f0a2779dbaf.zip |
[Fixes #14948] Hash#to_query: Changed a way how empty hash and empty array are serialized
Empty Hash or Array should not present in serialization result
{a: []}.to_query # => ""
{a: {}}.to_query # => ""
For more info see #14948.
Diffstat (limited to 'activesupport/test/core_ext/object')
-rw-r--r-- | activesupport/test/core_ext/object/to_query_test.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index f887a9e613..7457c4655a 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -49,13 +49,15 @@ class ToQueryTest < ActiveSupport::TestCase def test_nested_empty_hash assert_equal '', {}.to_query - assert_query_equal 'a=1&b%5Bc%5D=3&b%5Bd%5D=', + assert_query_equal 'a=1&b%5Bc%5D=3', { a: 1, b: { c: 3, d: {} } } + assert_query_equal '', + { a: {b: {c: {}}} } assert_query_equal 'b%5Bc%5D=false&b%5Be%5D=&b%5Bf%5D=&p=12', { p: 12, b: { c: false, e: nil, f: '' } } - assert_query_equal 'b%5Bc%5D=3&b%5Bf%5D=&b%5Bk%5D=', + assert_query_equal 'b%5Bc%5D=3&b%5Bf%5D=', { b: { c: 3, k: {}, f: '' } } - assert_query_equal 'a%5B%5D=&b=3', + assert_query_equal 'b=3', {a: [], b: 3} end |