Commit 19d2891c authored by Arturo Herrero's avatar Arturo Herrero

Merge branch 'fix-value-stream-stage-update' into 'master'

Fix updating Value stream stage

See merge request gitlab-org/gitlab!54427
parents 8399c20e d6459449
...@@ -26,7 +26,7 @@ module Analytics ...@@ -26,7 +26,7 @@ module Analytics
def to_be_deleted?(processed_params, stage_id) def to_be_deleted?(processed_params, stage_id)
processed_params.has_key?(:stages_attributes) && processed_params.has_key?(:stages_attributes) &&
processed_params[:stages_attributes].none? { |attrs| Integer(attrs[:id]) == stage_id } processed_params[:stages_attributes].none? { |attrs| attrs[:id] && Integer(attrs[:id]) == stage_id }
end end
def success_http_status def success_http_status
......
...@@ -101,5 +101,24 @@ RSpec.describe Analytics::CycleAnalytics::ValueStreams::UpdateService do ...@@ -101,5 +101,24 @@ RSpec.describe Analytics::CycleAnalytics::ValueStreams::UpdateService do
expect(subject.payload[:value_stream].stages.last.name).to eq('plan') expect(subject.payload[:value_stream].stages.last.name).to eq('plan')
end end
end end
context 'when removing a stage and adding a new stage' do
let(:params) do
{
name: 'VS 1',
stages: [
{ id: first_stage.id, name: first_stage.name, custom: true },
{ name: 'new stage', custom: true, start_event_identifier: 'merge_request_created', end_event_identifier: 'merge_request_closed' }
]
}
end
it 'creates the stage' do
expect(subject).to be_success
current_stage_names = subject.payload[:value_stream].stages.map(&:name)
expect(current_stage_names).to match_array([first_stage.name, 'new stage'])
end
end
end end
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