Skip to content

Commit

Permalink
DEV: Freeze time to avoid flakiness in scanned_upload_spec (#50)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidtaylorhq committed Jan 9, 2024
1 parent d5039ea commit d9e709b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/models/scanned_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit d9e709b

Please sign in to comment.