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
694666cf
Commit
694666cf
authored
Jun 21, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove references to to service
parent
b8c957ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
app/models/integration.rb
app/models/integration.rb
+4
-4
lib/api/services.rb
lib/api/services.rb
+1
-1
spec/models/integration_spec.rb
spec/models/integration_spec.rb
+4
-4
spec/requests/api/services_spec.rb
spec/requests/api/services_spec.rb
+6
-6
spec/support/shared_contexts/features/integrations/integrations_shared_context.rb
...exts/features/integrations/integrations_shared_context.rb
+1
-1
No files found.
app/models/integration.rb
View file @
694666cf
...
...
@@ -246,11 +246,11 @@ class Integration < ApplicationRecord
# Example: ["asana", ...]
# @deprecated
def
self
.
available_integration_names
(
include_project_specific:
true
,
include_dev:
true
)
service_
names
=
integration_names
service_
names
+=
project_specific_integration_names
if
include_project_specific
service_
names
+=
dev_integration_names
if
include_dev
names
=
integration_names
names
+=
project_specific_integration_names
if
include_project_specific
names
+=
dev_integration_names
if
include_dev
service_
names
.
sort_by
(
&
:downcase
)
names
.
sort_by
(
&
:downcase
)
end
def
self
.
integration_names
...
...
lib/api/services.rb
View file @
694666cf
...
...
@@ -110,7 +110,7 @@ module API
destroy_conditionally!
(
integration
)
do
attrs
=
service_attributes
(
integration
).
index_with
{
nil
}.
merge
(
active:
false
)
render_api_error!
(
'400 Bad Request'
,
400
)
unless
service
.
update
(
attrs
)
render_api_error!
(
'400 Bad Request'
,
400
)
unless
integration
.
update
(
attrs
)
end
end
...
...
spec/models/integration_spec.rb
View file @
694666cf
...
...
@@ -185,9 +185,9 @@ RSpec.describe Integration do
let
(
:project
)
{
build
(
:project
,
:repository
)
}
it
'test runs execute'
do
expect
(
service
).
to
receive
(
:execute
).
with
(
data
)
expect
(
integration
).
to
receive
(
:execute
).
with
(
data
)
service
.
test
(
data
)
integration
.
test
(
data
)
end
end
...
...
@@ -195,9 +195,9 @@ RSpec.describe Integration do
let
(
:project
)
{
build
(
:project
)
}
it
'test runs execute'
do
expect
(
service
).
to
receive
(
:execute
).
with
(
data
)
expect
(
integration
).
to
receive
(
:execute
).
with
(
data
)
service
.
test
(
data
)
integration
.
test
(
data
)
end
end
end
...
...
spec/requests/api/services_spec.rb
View file @
694666cf
...
...
@@ -24,11 +24,11 @@ RSpec.describe API::Services do
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
context
'
project with service
s'
do
context
'
with integration
s'
do
let!
(
:active_integration
)
{
create
(
:emails_on_push_integration
,
project:
project
,
active:
true
)
}
let!
(
:integration
)
{
create
(
:custom_issue_tracker_integration
,
project:
project
,
active:
false
)
}
it
"returns a list of all active
service
s"
do
it
"returns a list of all active
integration
s"
do
get
api
(
"/projects/
#{
project
.
id
}
/services"
,
user
)
aggregate_failures
'expect successful response with all active services'
do
...
...
@@ -141,7 +141,7 @@ RSpec.describe API::Services do
expect
(
json_response
[
'properties'
].
keys
).
to
match_array
(
service_instance
.
api_field_names
)
end
it
"returns all properties of inactive
service
#{
service
}
"
do
it
"returns all properties of inactive
integration
#{
service
}
"
do
deactive_service!
get
api
(
"/projects/
#{
project
.
id
}
/services/
#{
dashed_service
}
"
,
user
)
...
...
@@ -151,16 +151,16 @@ RSpec.describe API::Services do
expect
(
json_response
[
'properties'
].
keys
).
to
match_array
(
service_instance
.
api_field_names
)
end
it
"returns not found if
service
does not exist"
do
it
"returns not found if
integration
does not exist"
do
get
api
(
"/projects/
#{
project2
.
id
}
/services/
#{
dashed_service
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Service Not Found'
)
end
it
"returns not found if service exists but is in `Project#disabled_
service
s`"
do
it
"returns not found if service exists but is in `Project#disabled_
integration
s`"
do
expect_next_found_instance_of
(
Project
)
do
|
project
|
expect
(
project
).
to
receive
(
:disabled_
service
s
).
at_least
(
:once
).
and_return
([
service
])
expect
(
project
).
to
receive
(
:disabled_
integration
s
).
at_least
(
:once
).
and_return
([
service
])
end
get
api
(
"/projects/
#{
project
.
id
}
/services/
#{
dashed_service
}
"
,
user
)
...
...
spec/support/shared_contexts/features/integrations/integrations_shared_context.rb
View file @
694666cf
...
...
@@ -66,7 +66,7 @@ Integration.available_integration_names.each do |service|
return
unless
licensed_feature
stub_licensed_features
(
licensed_feature
=>
true
)
project
.
clear_memoization
(
:disabled_
service
s
)
project
.
clear_memoization
(
:disabled_
integration
s
)
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