Commit ebc2c17d authored by Dylan Griffith's avatar Dylan Griffith

Merge branch...

Merge branch '229547-adjust-code-which-creates-incident-issues-to-pass-issue_type-instead-of-label' into 'master'

Resolve "Adjust code which creates incident issues to pass issue_type instead of label"

Closes #229547

See merge request gitlab-org/gitlab!37781
parents 3c6ee540 dbe301b9
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
module IncidentManagement module IncidentManagement
module Incidents module Incidents
class CreateService < BaseService class CreateService < BaseService
ISSUE_TYPE = 'incident'
def initialize(project, current_user, title:, description:) def initialize(project, current_user, title:, description:)
super(project, current_user) super(project, current_user)
...@@ -16,7 +18,8 @@ module IncidentManagement ...@@ -16,7 +18,8 @@ module IncidentManagement
current_user, current_user,
title: title, title: title,
description: description, description: description,
label_ids: [find_or_create_incident_label.id] label_ids: [find_or_create_incident_label.id],
issue_type: ISSUE_TYPE
).execute ).execute
return error(issue.errors.full_messages.to_sentence, issue) unless issue.valid? return error(issue.errors.full_messages.to_sentence, issue) unless issue.valid?
......
---
title: Sets issue type for incident issues to incident
merge_request: 37781
author:
type: added
...@@ -25,12 +25,14 @@ RSpec.describe IncidentManagement::Incidents::CreateService do ...@@ -25,12 +25,14 @@ RSpec.describe IncidentManagement::Incidents::CreateService do
it 'created issue has correct attributes' do it 'created issue has correct attributes' do
create_incident create_incident
aggregate_failures do
expect(new_issue.title).to eq(title) expect(new_issue.title).to eq(title)
expect(new_issue.description).to eq(description) expect(new_issue.description).to eq(description)
expect(new_issue.author).to eq(user) expect(new_issue.author).to eq(user)
expect(new_issue.issue_type).to eq('incident')
expect(new_issue.labels.map(&:title)).to eq([label_title]) expect(new_issue.labels.map(&:title)).to eq([label_title])
end end
end
context 'when incident label does not exists' do context 'when incident label does not exists' do
it 'creates incident label' do it 'creates incident label' 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