aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/timestamp_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2011-10-26 18:20:12 +0100
committerPratik Naik <pratiknaik@gmail.com>2011-10-26 18:20:12 +0100
commit0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33 (patch)
tree0c0807a6690d5a645d157dcd6f7f83c955bc2f2c /activerecord/test/cases/timestamp_test.rb
parenta89d16b39b2af5276154d06e349b6a8705e13868 (diff)
downloadrails-0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33.tar.gz
rails-0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33.tar.bz2
rails-0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33.zip
Allow instances to disable record_timestamps
Diffstat (limited to 'activerecord/test/cases/timestamp_test.rb')
-rw-r--r--activerecord/test/cases/timestamp_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb
index 4445a12e1d..447aa29ffe 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -60,6 +60,16 @@ class TimestampTest < ActiveRecord::TestCase
Developer.record_timestamps = true
end
+ def test_saving_when_instance_record_timestamps_is_false_doesnt_update_its_timestamp
+ @developer.record_timestamps = false
+ assert Developer.record_timestamps
+
+ @developer.name = "John Smith"
+ @developer.save!
+
+ assert_equal @previously_updated_at, @developer.updated_at
+ end
+
def test_touching_an_attribute_updates_timestamp
previously_created_at = @developer.created_at
@developer.touch(:created_at)