From e68505a41a5c4ceeb0ed343daa0433846b054076 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Thu, 27 Dec 2012 17:28:42 +0100 Subject: 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. --- activesupport/test/json/encoding_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/test') 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 -- cgit v1.2.3