Commit 092ff52f authored by Vitali Tatarintev's avatar Vitali Tatarintev

Remove skip_settings_check from CreateIssueService

parent 355307a6
...@@ -17,8 +17,8 @@ module IncidentManagement ...@@ -17,8 +17,8 @@ module IncidentManagement
super(project, user, params) super(project, user, params)
end end
def execute(skip_settings_check: false) def execute
return error_with('setting disabled') unless skip_settings_check || incident_management_setting.create_issue? return error_with('setting disabled') unless incident_management_setting.create_issue?
return error_with('invalid alert') unless alert.valid? return error_with('invalid alert') unless alert.valid?
issue = create_issue issue = create_issue
......
...@@ -281,22 +281,12 @@ describe IncidentManagement::CreateIssueService do ...@@ -281,22 +281,12 @@ describe IncidentManagement::CreateIssueService do
setting.update!(create_issue: false) setting.update!(create_issue: false)
end end
context 'when skip_settings_check is false (default)' do it 'returns an error' do
it 'returns an error' do expect(service)
expect(service) .to receive(:log_error)
.to receive(:log_error) .with(error_message('setting disabled'))
.with(error_message('setting disabled'))
expect(subject).to eq(status: :error, message: 'setting disabled')
end
end
context 'when skip_settings_check is true' do
subject { service.execute(skip_settings_check: true) }
it 'creates an issue' do expect(subject).to eq(status: :error, message: 'setting disabled')
expect { subject }.to change(Issue, :count).by(1)
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