Commit c062666e authored by Arturo Herrero's avatar Arturo Herrero Committed by Adam Hegyi

Revert "Test to get the custom integration projects"

This reverts commit 16b471de628ad23ae846a8770fb207cd1fdeedb3.
parent ad256ac4
......@@ -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_integrations)
Project.where(id: custom_integration_project_ids)
end
end
end
......@@ -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
......
......@@ -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
......@@ -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
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