Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
092ff52f
Commit
092ff52f
authored
Jun 05, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove skip_settings_check from CreateIssueService
parent
355307a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
17 deletions
+7
-17
app/services/incident_management/create_issue_service.rb
app/services/incident_management/create_issue_service.rb
+2
-2
spec/services/incident_management/create_issue_service_spec.rb
...services/incident_management/create_issue_service_spec.rb
+5
-15
No files found.
app/services/incident_management/create_issue_service.rb
View file @
092ff52f
...
@@ -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
...
...
spec/services/incident_management/create_issue_service_spec.rb
View file @
092ff52f
...
@@ -281,7 +281,6 @@ describe IncidentManagement::CreateIssueService do
...
@@ -281,7 +281,6 @@ 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
)
...
@@ -291,15 +290,6 @@ describe IncidentManagement::CreateIssueService do
...
@@ -291,15 +290,6 @@ describe IncidentManagement::CreateIssueService do
end
end
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
change
(
Issue
,
:count
).
by
(
1
)
end
end
end
private
private
def
build_alert_payload
(
annotations:
{},
starts_at:
Time
.
current
)
def
build_alert_payload
(
annotations:
{},
starts_at:
Time
.
current
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment