Commit f46175c1 authored by Robert Speicher's avatar Robert Speicher

Merge branch '271214-flaky-spec-with-relative-times' into 'master'

Resolve "Flaky spec with relative times"

See merge request gitlab-org/gitlab!45852
parents 2c6b0690 4249fc8a
......@@ -252,12 +252,17 @@ RSpec.describe Member do
end
describe '.last_ten_days_excluding_today' do
let_it_be(:created_today) { create(:group_member, created_at: Date.today.beginning_of_day) }
let_it_be(:created_yesterday) { create(:group_member, created_at: 1.day.ago) }
let_it_be(:created_eleven_days_ago) { create(:group_member, created_at: 11.days.ago) }
let_it_be(:now) { Time.current }
let_it_be(:created_today) { create(:group_member, created_at: now.beginning_of_day) }
let_it_be(:created_yesterday) { create(:group_member, created_at: now - 1.day) }
let_it_be(:created_eleven_days_ago) { create(:group_member, created_at: now - 11.days) }
subject { described_class.last_ten_days_excluding_today }
before do
travel_to now
end
it { is_expected.to include(created_yesterday) }
it { is_expected.not_to include(created_today, created_eleven_days_ago) }
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment