Commit 35e160e8 authored by Alex Kalderimis's avatar Alex Kalderimis

Fix flaky spec by setting a fixed date

This addresses flakiness to do with daylight savings.
parent 9f962a44
......@@ -8,7 +8,9 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
let_it_be(:user_with_permissions) { create(:user) }
let_it_be(:user_without_permissions) { create(:user) }
let_it_be(:current_user) { user_with_permissions }
let_it_be(:starts_at) { Time.current.change(usec: 0) }
let(:execution_time) { DateTime.new(2021, 3, 1, 4, 5, 6) }
let(:starts_at) { DateTime.new(2021, 3, 1) }
let(:participants) do
[
......@@ -40,7 +42,9 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
end
end
subject(:execute) { service.execute }
subject(:execute) do
travel_to(execution_time) { service.execute }
end
context 'when the current_user is anonymous' do
let(:current_user) { nil }
......
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