@@ -98,8 +98,11 @@ def test_touching_an_attribute_updates_it
98
98
task = Task . first
99
99
previous_value = task . ending
100
100
task . touch ( :ending )
101
+
102
+ now = Time . now . change ( usec : 0 )
103
+
101
104
assert_not_equal previous_value , task . ending
102
- assert_in_delta Time . now , task . ending , 1
105
+ assert_in_delta now , task . ending , 1
103
106
end
104
107
105
108
def test_touching_an_attribute_updates_timestamp_with_given_time
@@ -120,10 +123,12 @@ def test_touching_many_attributes_updates_them
120
123
previous_ending = task . ending
121
124
task . touch ( :starting , :ending )
122
125
126
+ now = Time . now . change ( usec : 0 )
127
+
123
128
assert_not_equal previous_starting , task . starting
124
129
assert_not_equal previous_ending , task . ending
125
- assert_in_delta Time . now , task . starting , 1
126
- assert_in_delta Time . now , task . ending , 1
130
+ assert_in_delta now , task . starting , 1
131
+ assert_in_delta now , task . ending , 1
127
132
end
128
133
129
134
def test_touching_a_record_without_timestamps_is_unexceptional
0 commit comments