mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix locally flaky spec around date filters
This spec would fail on Australian systems early in the morning or in other timezones accordingly.
This commit is contained in:
@@ -11,6 +11,13 @@ RSpec.describe AffiliateSalesQuery do
|
||||
let(:yesterday) { Time.zone.yesterday }
|
||||
let(:tomorrow) { Time.zone.tomorrow }
|
||||
|
||||
around do |example|
|
||||
# Query dates are interpreted as UTC while the spec runs in
|
||||
# Melbourne time. At noon in Melbourne, the date is the same.
|
||||
# That simplifies the spec.
|
||||
Timecop.travel(Time.zone.today.noon, &example)
|
||||
end
|
||||
|
||||
it "returns data" do
|
||||
# Test data creation takes time.
|
||||
# So I'm executing more tests in one `it` block here.
|
||||
|
||||
Reference in New Issue
Block a user