aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorGaurish Sharma <contact@gaurishsharma.com>2013-08-09 04:32:00 +0530
committerGaurish Sharma <contact@gaurishsharma.com>2013-08-09 04:32:00 +0530
commit9f8116fb778ab4b90592d0a9ab88316132f00a78 (patch)
treec1e224641a7a90eaabb25ea7422defeac38a98b5 /activemodel/test
parent7fa93ceea814d2692958f6850a35ac2d42b184b5 (diff)
downloadrails-9f8116fb778ab4b90592d0a9ab88316132f00a78.tar.gz
rails-9f8116fb778ab4b90592d0a9ab88316132f00a78.tar.bz2
rails-9f8116fb778ab4b90592d0a9ab88316132f00a78.zip
Add tests for ActiveModel::Serializers::JSON#as_json ordering
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/serializers/json_serialization_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activemodel/test/cases/serializers/json_serialization_test.rb b/activemodel/test/cases/serializers/json_serialization_test.rb
index f0347081ee..476ba3d8c5 100644
--- a/activemodel/test/cases/serializers/json_serialization_test.rb
+++ b/activemodel/test/cases/serializers/json_serialization_test.rb
@@ -155,12 +155,21 @@ class JsonSerializationTest < ActiveModel::TestCase
end
end
- test "as_json should keep the default order in the hash" do
+ test "as_json should keep the MRI default order in the hash" do
+ skip "on JRuby as order is different" if defined? JRUBY_VERSION
json = @contact.as_json
assert_equal %w(name age created_at awesome preferences), json.keys
end
+ test "as_json should keep the JRuby default order in the hash" do
+ skip "on MRI as order is different" unless defined? JRUBY_VERSION
+ json = @contact.as_json
+
+ assert_equal %w(age name created_at awesome preferences), json.keys
+ end
+
+
test "from_json should work without a root (class attribute)" do
json = @contact.to_json
result = Contact.new.from_json(json)