diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-17 19:33:17 -0700 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-17 19:33:17 -0700 |
commit | 7e7570ab4e48c4449ce4cf104e46ad79bee1b135 (patch) | |
tree | 1af855584eded9cadae564238b16f04e027bc423 /activemodel/test/cases/serializers | |
parent | 9abe72c7600132aa964ca48c312ef981007ab8b1 (diff) | |
parent | 90c450f6cd792187eeb1e039e0ff3722beb8b5c1 (diff) | |
download | rails-7e7570ab4e48c4449ce4cf104e46ad79bee1b135.tar.gz rails-7e7570ab4e48c4449ce4cf104e46ad79bee1b135.tar.bz2 rails-7e7570ab4e48c4449ce4cf104e46ad79bee1b135.zip |
Merge pull request #11812 from gaurish/json-order
Add tests for ActiveModel::Serializers::JSON#as_json ordering variations
Diffstat (limited to 'activemodel/test/cases/serializers')
-rw-r--r-- | activemodel/test/cases/serializers/json_serialization_test.rb | 8 |
1 files changed, 7 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..8eb7a58e90 100644 --- a/activemodel/test/cases/serializers/json_serialization_test.rb +++ b/activemodel/test/cases/serializers/json_serialization_test.rb @@ -158,7 +158,13 @@ class JsonSerializationTest < ActiveModel::TestCase 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 + 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 attributes_order, json.keys end test "from_json should work without a root (class attribute)" do |