Commit 7feb5751 authored by syasonik's avatar syasonik

Use UTC for shift times calculated in specs

parent 583b4221
...@@ -16,5 +16,9 @@ FactoryBot.define do ...@@ -16,5 +16,9 @@ FactoryBot.define do
trait :removed do trait :removed do
is_removed { true } is_removed { true }
end end
trait :utc do
association :rotation, :utc, factory: :incident_management_oncall_rotation
end
end end
end end
...@@ -21,5 +21,9 @@ FactoryBot.define do ...@@ -21,5 +21,9 @@ FactoryBot.define do
create(:incident_management_oncall_participant, rotation: rotation, user: user) create(:incident_management_oncall_participant, rotation: rotation, user: user)
end end
end end
trait :utc do
association :schedule, :utc, factory: :incident_management_oncall_schedule
end
end end
end end
...@@ -6,5 +6,9 @@ FactoryBot.define do ...@@ -6,5 +6,9 @@ FactoryBot.define do
sequence(:name) { |n| "On-call Schedule ##{n}" } sequence(:name) { |n| "On-call Schedule ##{n}" }
description { 'On-call description' } description { 'On-call description' }
timezone { 'Europe/Berlin' } timezone { 'Europe/Berlin' }
trait :utc do
timezone { 'Etc/UTC' }
end
end end
end end
...@@ -6,5 +6,9 @@ FactoryBot.define do ...@@ -6,5 +6,9 @@ FactoryBot.define do
rotation { participant.rotation } rotation { participant.rotation }
starts_at { rotation.starts_at } starts_at { rotation.starts_at }
ends_at { starts_at + rotation.shift_cycle_duration } ends_at { starts_at + rotation.shift_cycle_duration }
trait :utc do
association :participant, :utc, :with_developer_access, factory: :incident_management_oncall_participant
end
end end
end end
...@@ -91,7 +91,7 @@ RSpec.describe IncidentManagement::OncallRotations::PersistShiftsJob do ...@@ -91,7 +91,7 @@ RSpec.describe IncidentManagement::OncallRotations::PersistShiftsJob do
end end
context 'when rotation has saved shifts' do context 'when rotation has saved shifts' do
let_it_be(:existing_shift) { create(:incident_management_oncall_shift) } let_it_be(:existing_shift) { create(:incident_management_oncall_shift, :utc) }
let_it_be_with_reload(:rotation) { existing_shift.rotation } let_it_be_with_reload(:rotation) { existing_shift.rotation }
context 'when current time is during a saved shift' do context 'when current time is during a saved shift' do
......
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