aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/timestamp_test.rb
diff options
context:
space:
mode:
authorWincent Colaiuta <win@wincent.com>2010-08-24 15:20:02 +0200
committerJosé Valim <jose.valim@gmail.com>2010-08-24 10:32:45 -0300
commit7d71b785a95ac77c214e708f615f9ec6402fc016 (patch)
treec74e59b3030ce5d1741c46e84d0d7693e280f5d1 /activerecord/test/cases/timestamp_test.rb
parentb4f304b7b68e0b4fd780cc6d0944edefc362669d (diff)
downloadrails-7d71b785a95ac77c214e708f615f9ec6402fc016.tar.gz
rails-7d71b785a95ac77c214e708f615f9ec6402fc016.tar.bz2
rails-7d71b785a95ac77c214e708f615f9ec6402fc016.zip
Add test case for ActiveRecord::Base.record_timestamps = false
This is a failing test case for Lighthouse ticket #5440: https://rails.lighthouseapp.com/projects/8994/tickets/5440 Signed-off-by: José Valim <jose.valim@gmail.com>
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 fce27d8972..dea93b38dd 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -38,6 +38,16 @@ class TimestampTest < ActiveRecord::TestCase
assert_equal previous_salary, @developer.salary
end
+ def test_saving_when_record_timestamps_is_false_doesnt_update_its_timestamp
+ Developer.record_timestamps = false
+ @developer.name = "John Smith"
+ @developer.save!
+
+ assert_equal @previously_updated_at, @developer.updated_at
+ ensure
+ Developer.record_timestamps = true
+ end
+
def test_touching_a_different_attribute
previously_created_at = @developer.created_at
@developer.touch(:created_at)