Permalink
Browse files

ordering can change depending on ruby version, so parse the JSON and …

…verify data structure equality
  • Loading branch information...
tenderlove committed Jan 18, 2011
1 parent 6a8f7f0 commit d780d1f508c880c59d6d932bd052cb0b1c1c76b0
Showing with 10 additions and 3 deletions.
  1. +10 −3 activesupport/test/json/encoding_test.rb
@@ -234,9 +234,16 @@ def test_struct_encoding
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

0 comments on commit d780d1f

Please sign in to comment.