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
c062666e
Commit
c062666e
authored
Jun 04, 2020
by
Arturo Herrero
Committed by
Adam Hegyi
Jun 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Test to get the custom integration projects"
This reverts commit 16b471de628ad23ae846a8770fb207cd1fdeedb3.
parent
ad256ac4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
20 deletions
+13
-20
app/models/concerns/integration.rb
app/models/concerns/integration.rb
+9
-6
config/routes/admin.rb
config/routes/admin.rb
+0
-1
spec/controllers/admin/integrations_controller_spec.rb
spec/controllers/admin/integrations_controller_spec.rb
+2
-11
spec/models/integration_spec.rb
spec/models/integration_spec.rb
+2
-2
No files found.
app/models/concerns/integration.rb
View file @
c062666e
...
...
@@ -4,13 +4,16 @@ module Integration
extend
ActiveSupport
::
Concern
class_methods
do
def
with_custom_integration_compared_to
(
integration
)
custom_integrations
=
Service
.
select
(
'1'
)
.
where
(
type:
integration
.
type
,
inherit_from_id:
nil
)
.
where
(
'services.project_id = projects.id'
)
def
with_custom_integration_for
(
integration
,
page
=
nil
,
per
=
nil
)
custom_integration_project_ids
=
Service
.
where
(
type:
integration
.
type
)
.
where
(
inherit_from_id:
nil
)
.
distinct
# Required until https://gitlab.com/gitlab-org/gitlab/-/issues/207385
.
page
(
page
)
.
per
(
per
)
.
pluck
(
:project_id
)
Project
.
where
(
'EXISTS (?)'
,
custom_integration
s
)
Project
.
where
(
id:
custom_integration_project_id
s
)
end
end
end
config/routes/admin.rb
View file @
c062666e
...
...
@@ -118,7 +118,6 @@ namespace :admin do
resources
:services
,
only:
[
:index
,
:edit
,
:update
]
resources
:integrations
,
only:
[
:edit
,
:update
]
do
member
do
get
:custom_integration_projects
put
:test
end
end
...
...
spec/controllers/admin/integrations_controller_spec.rb
View file @
c062666e
...
...
@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec
.
describe
Admin
::
IntegrationsController
do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:integration
)
{
create
(
:jira_service
,
:instance
)
}
before
do
sign_in
(
admin
)
...
...
@@ -34,6 +33,8 @@ RSpec.describe Admin::IntegrationsController do
end
describe
'#update'
do
let
(
:integration
)
{
create
(
:jira_service
,
:instance
)
}
before
do
allow
(
PropagateIntegrationWorker
).
to
receive
(
:perform_async
)
...
...
@@ -67,14 +68,4 @@ RSpec.describe Admin::IntegrationsController do
end
end
end
describe
'#custom_integration_projects'
do
it
'calls to get the custom integration projects'
do
allow
(
Project
).
to
receive_message_chain
(
:with_custom_integration_compared_to
,
:page
,
:per
)
get
:custom_integration_projects
,
params:
{
id:
integration
.
class
.
to_param
}
expect
(
Project
).
to
have_received
(
:with_custom_integration_compared_to
).
with
(
integration
)
end
end
end
spec/models/integration_spec.rb
View file @
c062666e
...
...
@@ -13,9 +13,9 @@ RSpec.describe Integration do
create
(
:slack_service
,
project:
project_1
,
inherit_from_id:
nil
)
end
describe
'#with_custom_integration_
compared_to
'
do
describe
'#with_custom_integration_
for
'
do
it
'returns projects with custom integrations'
do
expect
(
Project
.
with_custom_integration_
compared_to
(
instance_integration
)).
to
contain_exactly
(
project_2
)
expect
(
Project
.
with_custom_integration_
for
(
instance_integration
)).
to
contain_exactly
(
project_2
)
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