Skip to content

Commit

Permalink
rewrite order dependent test case. rails#8185
Browse files Browse the repository at this point in the history
As reported (rails#8185 (comment))
this test relied on the order a hash was serialized. Comparing the parsed
hash makes the test no longer order dependent.
  • Loading branch information
senny committed Dec 27, 2012
1 parent 2283a1d commit e68505a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion activesupport/test/json/encoding_test.rb
Expand Up @@ -276,7 +276,8 @@ def test_to_json_should_not_keep_options_around
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
Expand Down

0 comments on commit e68505a

Please sign in to comment.