aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/json
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-17 16:06:55 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-17 16:06:55 -0800
commitd780d1f508c880c59d6d932bd052cb0b1c1c76b0 (patch)
tree11c9cf24210923020608443690d23cc94b683f71 /activesupport/test/json
parent6a8f7f0e04bce3ade8ff24fce80580cd23fae6d7 (diff)
downloadrails-d780d1f508c880c59d6d932bd052cb0b1c1c76b0.tar.gz
rails-d780d1f508c880c59d6d932bd052cb0b1c1c76b0.tar.bz2
rails-d780d1f508c880c59d6d932bd052cb0b1c1c76b0.zip
ordering can change depending on ruby version, so parse the JSON and verify data structure equality
Diffstat (limited to 'activesupport/test/json')
-rw-r--r--activesupport/test/json/encoding_test.rb13
1 files 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