aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2012-12-27 17:28:42 +0100
committerYves Senn <yves.senn@gmail.com>2012-12-27 17:28:42 +0100
commite68505a41a5c4ceeb0ed343daa0433846b054076 (patch)
treed7432a6649c9acd0f65c1ac1de0450af2a0d27b2 /activesupport
parent2283a1d62e36bc7787a01e87a5d2a018e83da22c (diff)
downloadrails-e68505a41a5c4ceeb0ed343daa0433846b054076.tar.gz
rails-e68505a41a5c4ceeb0ed343daa0433846b054076.tar.bz2
rails-e68505a41a5c4ceeb0ed343daa0433846b054076.zip
rewrite order dependent test case. #8185
As reported (https://github.com/rails/rails/pull/8185#issuecomment-11702226) this test relied on the order a hash was serialized. Comparing the parsed hash makes the test no longer order dependent.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/json/encoding_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index b6e2cd4529..12ce250eb3 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -276,7 +276,8 @@ class TestJSONEncoding < ActiveSupport::TestCase
f.bar = "world"
hash = {"foo" => f, "other_hash" => {"foo" => "other_foo", "test" => "other_test"}}
- assert_equal(%({"foo":{"foo":"hello","bar":"world"},"other_hash":{"foo":"other_foo","test":"other_test"}}), hash.to_json)
+ assert_equal({"foo"=>{"foo"=>"hello","bar"=>"world"},
+ "other_hash" => {"foo"=>"other_foo","test"=>"other_test"}}, JSON.parse(hash.to_json))
end
def test_struct_encoding