1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #29491 from kamipo/add_test_case_for_28754

Add a test case for #28754
This commit is contained in:
Matthew Draper 2017-06-18 23:44:40 +09:30 committed by GitHub
commit b37aa68ff6

View file

@ -169,6 +169,25 @@ module JSONSharedTestCases
assert_not json.changed?
end
def test_changes_in_place_ignores_key_order
json = klass.new
assert_not json.changed?
json.payload = { "three" => "four", "one" => "two" }
json.save!
json.reload
json.payload = { "three" => "four", "one" => "two" }
assert_not json.changed?
json.payload = [{ "three" => "four", "one" => "two" }, { "seven" => "eight", "five" => "six" }]
json.save!
json.reload
json.payload = [{ "three" => "four", "one" => "two" }, { "seven" => "eight", "five" => "six" }]
assert_not json.changed?
end
def test_changes_in_place_with_ruby_object
time = Time.now.utc
json = klass.create!(payload: time)