diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-03-07 16:42:14 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-30 05:02:33 +0900 |
commit | 71cd0659699a539ef8713faf776d12bef9ff0ce8 (patch) | |
tree | 99831c62dd5ff20c02a45c00bc3036ebdfcb9d2f /activerecord/test | |
parent | cbf378bc2725afe55e81d74bf97be7d484309863 (diff) | |
download | rails-71cd0659699a539ef8713faf776d12bef9ff0ce8.tar.gz rails-71cd0659699a539ef8713faf776d12bef9ff0ce8.tar.bz2 rails-71cd0659699a539ef8713faf776d12bef9ff0ce8.zip |
Deserialize a raw value from the database in `changed_in_place?` for `AbstractJson`
Structured type values sometimes caused representation problems (keys
sort order, spaces, etc). A raw value from the database should be
deserialized (normalized) to prevent the problems.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/json_shared_test_cases.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/json_shared_test_cases.rb b/activerecord/test/cases/json_shared_test_cases.rb index d190b027bf..ef5ca86874 100644 --- a/activerecord/test/cases/json_shared_test_cases.rb +++ b/activerecord/test/cases/json_shared_test_cases.rb @@ -160,6 +160,17 @@ module JSONSharedTestCases assert_not json.changed? end + def test_changes_in_place_with_ruby_object + time = Time.now.utc + json = JsonDataType.create!(payload: time) + + json.reload + assert_not json.changed? + + json.payload = time + assert_not json.changed? + end + def test_assigning_string_literal json = JsonDataType.create!(payload: "foo") assert_equal "foo", json.payload |