Commit 8aafe8b4 authored by Sean Arnold's avatar Sean Arnold

Update association calls after prefix change

parent 5bd6722c
...@@ -26,14 +26,14 @@ module IncidentManagement ...@@ -26,14 +26,14 @@ module IncidentManagement
return error_no_license unless available? return error_no_license unless available?
return error_no_permissions unless allowed? return error_no_permissions unless allowed?
oncall_rotation = schedule.oncall_rotations.create(params.except(:participants)) oncall_rotation = schedule.rotations.create(params.except(:participants))
return error_in_create(oncall_rotation) unless oncall_rotation.persisted? return error_in_create(oncall_rotation) unless oncall_rotation.persisted?
new_participants = Array(params[:participants]).map do |participant| new_participants = Array(params[:participants]).map do |participant|
OncallParticipant.new( OncallParticipant.new(
oncall_rotation: oncall_rotation, rotation: oncall_rotation,
participant: participant[:user], user: participant[:user],
color_palette: participant[:color_palette], color_palette: participant[:color_palette],
color_weight: participant[:color_weight] color_weight: participant[:color_weight]
) )
......
...@@ -6,7 +6,7 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do ...@@ -6,7 +6,7 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project) } let_it_be(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project) }
let_it_be_with_refind(:oncall_rotation) { create(:incident_management_oncall_rotation, oncall_schedule: oncall_schedule) } let_it_be_with_refind(:oncall_rotation) { create(:incident_management_oncall_rotation, schedule: oncall_schedule) }
subject(:policy) { described_class.new(user, oncall_rotation) } subject(:policy) { described_class.new(user, oncall_rotation) }
......
...@@ -69,7 +69,7 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do ...@@ -69,7 +69,7 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
end end
context 'when an on-call rotation already exists' do context 'when an on-call rotation already exists' do
let!(:oncall_schedule) { create(:incident_management_oncall_rotation, oncall_schedule: schedule, name: 'On-call rotation') } let!(:oncall_rotation) { create(:incident_management_oncall_rotation, schedule: schedule, name: 'On-call rotation') }
it_behaves_like 'error response', 'Name has already been taken' it_behaves_like 'error response', 'Name has already been taken'
end 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