diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-02-22 12:05:39 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-02-22 12:05:39 -0300 |
commit | aa3d4408716a2470f85d8e0443cbc7a4ce1ff53d (patch) | |
tree | a29e91c66fc7d89c9d2886d25bd4e30733d22ef3 /activerecord | |
parent | c901fad42cb49ad5ac847b1159e38fdfe12ab76a (diff) | |
parent | 71366209d56a62c90ef39fb00470305f7caa5a0f (diff) | |
download | rails-aa3d4408716a2470f85d8e0443cbc7a4ce1ff53d.tar.gz rails-aa3d4408716a2470f85d8e0443cbc7a4ce1ff53d.tar.bz2 rails-aa3d4408716a2470f85d8e0443cbc7a4ce1ff53d.zip |
Merge pull request #23521 from kamipo/fix_assert_in_delta_failure
Fix `assert_in_delta` test failure
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/timestamp_test.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb index 970f6bcf4a..937b84bccc 100644 --- a/activerecord/test/cases/timestamp_test.rb +++ b/activerecord/test/cases/timestamp_test.rb @@ -98,8 +98,11 @@ class TimestampTest < ActiveRecord::TestCase task = Task.first previous_value = task.ending task.touch(:ending) + + now = Time.now.change(usec: 0) + assert_not_equal previous_value, task.ending - assert_in_delta Time.now, task.ending, 1 + assert_in_delta now, task.ending, 1 end def test_touching_an_attribute_updates_timestamp_with_given_time @@ -120,10 +123,12 @@ class TimestampTest < ActiveRecord::TestCase previous_ending = task.ending task.touch(:starting, :ending) + now = Time.now.change(usec: 0) + assert_not_equal previous_starting, task.starting assert_not_equal previous_ending, task.ending - assert_in_delta Time.now, task.starting, 1 - assert_in_delta Time.now, task.ending, 1 + assert_in_delta now, task.starting, 1 + assert_in_delta now, task.ending, 1 end def test_touching_a_record_without_timestamps_is_unexceptional |