diff options
author | Vladimir Dementyev <dementiev.vm@gmail.com> | 2019-03-25 18:50:27 -0400 |
---|---|---|
committer | Vladimir Dementyev <dementiev.vm@gmail.com> | 2019-03-25 18:53:07 -0400 |
commit | b574d283e57930105d505c2d34f6d4777dc21069 (patch) | |
tree | 3880e94c61719d355a3aa509451414b8ab6b91b3 /activerecord/test | |
parent | 61a39ffcc6614d4369f524b5687309d9f12f279f (diff) | |
download | rails-b574d283e57930105d505c2d34f6d4777dc21069.tar.gz rails-b574d283e57930105d505c2d34f6d4777dc21069.tar.bz2 rails-b574d283e57930105d505c2d34f6d4777dc21069.zip |
Add saved changes helpers for store accessors
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/store_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb index 1947868f05..91c0e959f4 100644 --- a/activerecord/test/cases/store_test.rb +++ b/activerecord/test/cases/store_test.rb @@ -136,6 +136,17 @@ class StoreTest < ActiveRecord::TestCase assert_equal ["Dallas", "Lena"], @john.partner_name_change end + test "saved changes tracking for accessors" do + @john.spouse[:name] = "Lena" + assert @john.partner_name_changed? + + @john.save! + assert_not @john.partner_name_change + assert @john.saved_change_to_partner_name? + assert_equal ["Dallas", "Lena"], @john.saved_change_to_partner_name + assert_equal "Dallas", @john.partner_name_before_last_save + end + test "object initialization with not nullable column" do assert_equal true, @john.remember_login end |