diff options
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/serializers/json_serialization_test.rb | 11 |
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) |