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
a517983c
Commit
a517983c
authored
Apr 16, 2020
by
Arturo Herrero
Committed by
Peter Leitzen
Apr 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs saving an invalid service
After the changes in
ab81251d
the specs were misleading.
parent
0a0077c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
14 deletions
+12
-14
app/controllers/concerns/integrations_actions.rb
app/controllers/concerns/integrations_actions.rb
+1
-3
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+1
-1
lib/api/services.rb
lib/api/services.rb
+1
-3
spec/controllers/admin/integrations_controller_spec.rb
spec/controllers/admin/integrations_controller_spec.rb
+5
-4
spec/controllers/groups/settings/integrations_controller_spec.rb
...ntrollers/groups/settings/integrations_controller_spec.rb
+4
-3
No files found.
app/controllers/concerns/integrations_actions.rb
View file @
a517983c
...
...
@@ -15,9 +15,7 @@ module IntegrationsActions
end
def
update
integration
.
attributes
=
service_params
[
:service
]
saved
=
integration
.
save
(
context: :manual_change
)
saved
=
integration
.
update
(
service_params
[
:service
])
respond_to
do
|
format
|
format
.
html
do
...
...
app/models/project_services/issue_tracker_service.rb
View file @
a517983c
...
...
@@ -172,7 +172,7 @@ class IssueTrackerService < Service
end
def
one_issue_tracker
return
if
template?
return
if
template?
||
instance?
return
if
project
.
blank?
if
project
.
services
.
external_issue_trackers
.
where
.
not
(
id:
id
).
any?
...
...
lib/api/services.rb
View file @
a517983c
...
...
@@ -130,13 +130,11 @@ module API
TRIGGER_SERVICES
.
each
do
|
service_slug
,
settings
|
helpers
do
# rubocop: disable CodeReuse/ActiveRecord
def
slash_command_service
(
project
,
service_slug
,
params
)
project
.
services
.
active
.
where
(
template:
false
).
find
do
|
service
|
project
.
services
.
active
.
find
do
|
service
|
service
.
try
(
:token
)
==
params
[
:token
]
&&
service
.
to_param
==
service_slug
.
underscore
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
params
do
...
...
spec/controllers/admin/integrations_controller_spec.rb
View file @
a517983c
...
...
@@ -49,11 +49,12 @@ describe Admin::IntegrationsController do
end
context
'invalid params'
do
let
(
:url
)
{
'
https://jira.localhost
'
}
let
(
:url
)
{
'
invalid
'
}
it
'updates the integration'
do
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
integration
.
reload
.
url
).
to
eq
(
url
)
it
'does not update the integration'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:edit
)
expect
(
integration
.
reload
.
url
).
not_to
eq
(
url
)
end
end
end
...
...
spec/controllers/groups/settings/integrations_controller_spec.rb
View file @
a517983c
...
...
@@ -100,11 +100,12 @@ describe Groups::Settings::IntegrationsController do
end
context
'invalid params'
do
let
(
:url
)
{
'
https://jira.localhost
'
}
let
(
:url
)
{
'
invalid
'
}
it
'does not update the integration'
do
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
integration
.
reload
.
url
).
to
eq
(
url
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:edit
)
expect
(
integration
.
reload
.
url
).
not_to
eq
(
url
)
end
end
end
...
...
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