Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #8066 from cfabianski/AddTestForSerializationMethod

Add test for code change introduced in this commit f20032f
  • Loading branch information...
commit a4ac2b4d0a56ae2221b90314df1f806cb9ef9192 2 parents 008154e + 3152ee8
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 activemodel/test/cases/serializers/json_serialization_test.rb
View
9 activemodel/test/cases/serializers/json_serialization_test.rb
@@ -155,6 +155,15 @@ def @contact.favorite_quote; "Constraints are liberating"; end
end
end
+ test "as_json should keep the default order in the hash" do
+ json = @contact.as_json
+ keys = json.keys
+
+ %w(name age created_at awesome preferences).each_with_index do |field, index|
+ assert_equal keys.index(field), index
+ end
+ end
+
test "from_json should work without a root (class attribute)" do
json = @contact.to_json
result = Contact.new.from_json(json)
Please sign in to comment.
Something went wrong with that request. Please try again.