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:
Maikel Linke
2024-10-10 09:58:01 +11:00
parent 71ca292c92
commit f0b6403c1d

View File

@@ -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.