aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-09-23 09:33:43 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-09-23 09:33:43 -0600
commit05436172db724cb7863571d01b86bee6ad03ada0 (patch)
tree6c0e7f15bc99a5b320d0d6342384baaeecb32993 /activerecord/test/cases/associations
parent2c7d0d42ac539484918c1cf60be4f24dc5587ad0 (diff)
downloadrails-05436172db724cb7863571d01b86bee6ad03ada0.tar.gz
rails-05436172db724cb7863571d01b86bee6ad03ada0.tar.bz2
rails-05436172db724cb7863571d01b86bee6ad03ada0.zip
Don't rely on subsecond precision being applied in tests
When I originally reviewed the #20317, I believe these changes were present, but it appears that it was later updated so that they were removed. Since Travis hadn't re-run the build, this slipped through.
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb4
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 02b67f901f..938350627f 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -500,7 +500,9 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
line_item = LineItem.create!
invoice = Invoice.create!(line_items: [line_item])
initial = invoice.updated_at
- line_item.touch
+ travel(1.second) do
+ line_item.touch
+ end
assert_not_equal initial, invoice.reload.updated_at
end
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 0beaf0056a..cd19a7a5bc 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -170,7 +170,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
part = ShipPart.create(name: 'cockpit')
updated_at = part.updated_at
- ship.parts << part
+ travel(1.second) do
+ ship.parts << part
+ end
assert_equal part.ship, ship
assert_not_equal part.updated_at, updated_at