From d780d1f508c880c59d6d932bd052cb0b1c1c76b0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 17 Jan 2011 16:06:55 -0800 Subject: ordering can change depending on ruby version, so parse the JSON and verify data structure equality --- activesupport/test/json/encoding_test.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index f7ca39f0f6..d5fcbf15b7 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -234,9 +234,16 @@ class TestJSONEncoding < Test::Unit::TestCase json_custom = custom.to_json end - assert_equal %({"name":"David","email":"sample@example.com"}), json_strings - assert_equal %({"name":"David","date":"2010/01/01"}), json_string_and_date - assert_equal %({"sub":{"name":"David","date":"2010/01/01"},"name":"David"}), json_custom + assert_equal({"name" => "David", + "sub" => { + "name" => "David", + "date" => "2010/01/01" }}, JSON.parse(json_custom)) + + assert_equal({"name" => "David", "email" => "sample@example.com"}, + JSON.parse(json_strings)) + + assert_equal({"name" => "David", "date" => "2010/01/01"}, + JSON.parse(json_string_and_date)) end protected -- cgit v1.2.3