aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/dirty_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-11-02 01:42:47 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-11-02 01:42:49 +0000
commite911ed1f0f1633b0ae1b5146805eee6388b1f02f (patch)
tree3b965b11bb7925623d2d7f23f90e3f1391be0a36 /activerecord/test/cases/dirty_test.rb
parentc5c2e4fefde539e1c1753d4ca184c3bf81d496be (diff)
downloadrails-e911ed1f0f1633b0ae1b5146805eee6388b1f02f.tar.gz
rails-e911ed1f0f1633b0ae1b5146805eee6388b1f02f.tar.bz2
rails-e911ed1f0f1633b0ae1b5146805eee6388b1f02f.zip
Ensure save always updates timestamps when serialized attributes are present
Diffstat (limited to 'activerecord/test/cases/dirty_test.rb')
-rw-r--r--activerecord/test/cases/dirty_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index bde93d1c85..b1a54af192 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -395,6 +395,20 @@ class DirtyTest < ActiveRecord::TestCase
end
end
+ def test_save_always_should_update_timestamps_when_serialized_attributes_are_present
+ with_partial_updates(Topic) do
+ topic = Topic.create!(:content => {:a => "a"})
+ topic.save!
+
+ updated_at = topic.updated_at
+ topic.content[:hello] = 'world'
+ topic.save!
+
+ assert_not_equal updated_at, topic.updated_at
+ assert_equal 'world', topic.content[:hello]
+ end
+ end
+
def test_save_should_not_save_serialized_attribute_with_partial_updates_if_not_present
with_partial_updates(Topic) do
Topic.create!(:author_name => 'Bill', :content => {:a => "a"})