aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
diff options
context:
space:
mode:
authorpalkan <dementiev.vm@gmail.com>2015-03-14 19:50:02 +0300
committerVladimir Dementyev <dementiev.vm@gmail.com>2019-03-25 18:49:44 -0400
commit61a39ffcc6614d4369f524b5687309d9f12f279f (patch)
tree9a989e8712d56452ba19705153edb9043a885e9c /activerecord/test/cases/adapters
parent6b5130720eee785b45dfc0fc5044224cdc2b6c98 (diff)
downloadrails-61a39ffcc6614d4369f524b5687309d9f12f279f.tar.gz
rails-61a39ffcc6614d4369f524b5687309d9f12f279f.tar.bz2
rails-61a39ffcc6614d4369f524b5687309d9f12f279f.zip
Add dirty methods for store accessors
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index cd45975f70..671d8211a7 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -153,6 +153,22 @@ class PostgresqlHstoreTest < ActiveRecord::PostgreSQLTestCase
assert_equal "GMT", y.timezone
end
+ def test_changes_with_store_accessors
+ x = Hstore.new(language: "de")
+ assert x.language_changed?
+ assert_nil x.language_was
+ assert_equal [nil, "de"], x.language_change
+ x.save!
+
+ assert_not x.language_changed?
+ x.reload
+
+ x.settings = nil
+ assert x.language_changed?
+ assert_equal "de", x.language_was
+ assert_equal ["de", nil], x.language_change
+ end
+
def test_changes_in_place
hstore = Hstore.create!(settings: { "one" => "two" })
hstore.settings["three"] = "four"