mirror of https://github.com/rails/rails
Avoid Skip in test, have a unified test for order
This commit is contained in:
parent
9f8116fb77
commit
90c450f6cd
|
@ -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
|
||||
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 "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)
|
||||
|
|
Loading…
Reference in New Issue