Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…verify data structure equality
  • Loading branch information...
commit d780d1f508c880c59d6d932bd052cb0b1c1c76b0 1 parent 6a8f7f0
@tenderlove tenderlove authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 activesupport/test/json/encoding_test.rb
View
13 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
Please sign in to comment.
Something went wrong with that request. Please try again.