Skip to content

Commit

Permalink
Add test case for ActiveRecord::Base.record_timestamps = false
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wincent authored and josevalim committed Aug 24, 2010
1 parent 7a7012c commit 5ccdb36
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions activerecord/test/cases/timestamp_test.rb
Expand Up @@ -38,6 +38,16 @@ def test_touching_a_record_updates_its_timestamp
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)
Expand Down

0 comments on commit 5ccdb36

Please sign in to comment.