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
1 changed files with 19 additions and 0 deletions

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)