From d9e709bc4cb93b7ea2ab2053f40f1cc3ce264b8c Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 9 Jan 2024 12:44:34 +0000 Subject: [PATCH] DEV: Freeze time to avoid flakiness in scanned_upload_spec (#50) We're using `eq_time` to compare expected timestamps. That only allows a 1ms leeway, so we gotta freeze time to make the spec reliable on slower machines --- spec/models/scanned_upload_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/models/scanned_upload_spec.rb b/spec/models/scanned_upload_spec.rb index 4faa13d..8aa8bc0 100644 --- a/spec/models/scanned_upload_spec.rb +++ b/spec/models/scanned_upload_spec.rb @@ -88,6 +88,7 @@ end it "sets the next scan to one week from now after the first week" do + freeze_time upload.created_at = 1.week.ago scanned_upload.next_scan_at = nil @@ -97,6 +98,7 @@ end it "sets the next scan to x weeks in the future where x is the number of weeks since created" do + freeze_time upload.created_at = 2.weeks.ago scanned_upload.next_scan_at = 1.day.ago