diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index cc5d71447b..2946e849e0 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -532,19 +532,20 @@ class QueryTest < Test::Unit::TestCase def test_simple_conversion assert_equal 'a=10', {:a => 10}.to_query end - + def test_nested_conversion - assert_equal 'person[name]=Nicholas&person[login]=seckar', - {:person => {:name => 'Nicholas', :login => 'seckar'}}.to_query + expected = %w(person[name]=Nicholas person[login]=seckar) + actual = {:person => {:name => 'Nicholas', :login => 'seckar'}}.to_query + assert_equal expected.sort, actual.split('&').sort end - + def test_multiple_nested assert_equal 'account[person][id]=20&person[id]=10', {:person => {:id => 10}, :account => {:person => {:id => 20}}}.to_query end - + def test_array_values assert_equal 'person[id][]=10&person[id][]=20', {:person => {:id => [10, 20]}}.to_query end -end
\ No newline at end of file +end |