mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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>
This commit is contained in:
committed by
José Valim
parent
7a7012c717
commit
5ccdb362b4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user