aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/serializers/json_serialization_test.rb
diff options
context:
space:
mode:
authorGaurish Sharma <contact@gaurishsharma.com>2013-08-09 15:27:21 +0530
committerGaurish Sharma <contact@gaurishsharma.com>2013-08-09 15:27:21 +0530
commit90c450f6cd792187eeb1e039e0ff3722beb8b5c1 (patch)
tree02bb975ad60c5fda5bbb236a5eda974d65285643 /activemodel/test/cases/serializers/json_serialization_test.rb
parent9f8116fb778ab4b90592d0a9ab88316132f00a78 (diff)
downloadrails-90c450f6cd792187eeb1e039e0ff3722beb8b5c1.tar.gz
rails-90c450f6cd792187eeb1e039e0ff3722beb8b5c1.tar.bz2
rails-90c450f6cd792187eeb1e039e0ff3722beb8b5c1.zip
Avoid Skip in test, have a unified test for order
Diffstat (limited to 'activemodel/test/cases/serializers/json_serialization_test.rb')
-rw-r--r--activemodel/test/cases/serializers/json_serialization_test.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/activemodel/test/cases/serializers/json_serialization_test.rb b/activemodel/test/cases/serializers/json_serialization_test.rb
index 476ba3d8c5..8eb7a58e90 100644
--- a/activemodel/test/cases/serializers/json_serialization_test.rb
+++ b/activemodel/test/cases/serializers/json_serialization_test.rb
@@ -155,21 +155,18 @@ class JsonSerializationTest < ActiveModel::TestCase
end
end
- test "as_json should keep the MRI default order in the hash" do
- skip "on JRuby as order is different" if defined? JRUBY_VERSION
+ test "as_json should keep the default order in the hash" do
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
+ attributes_order = %w(name age created_at awesome preferences)
+ #Order on JRUBY is different
+ if defined? JRUBY_VERSION
+ attributes_order = %w(age name created_at awesome preferences)
+ end
- assert_equal %w(age name created_at awesome preferences), json.keys
+ assert_equal attributes_order, json.keys
end
-
test "from_json should work without a root (class attribute)" do
json = @contact.to_json
result = Contact.new.from_json(json)