Commit 378ac54c authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch '328888-only-test-project-integrations' into 'master'

Only test project integrations

See merge request gitlab-org/gitlab!65049
parents d3b1f64c 409514e4
......@@ -484,7 +484,7 @@ class Integration < ApplicationRecord
# Disable test for instance-level and group-level integrations.
# https://gitlab.com/gitlab-org/gitlab/-/issues/213138
def can_test?
!(instance_level? || group_level?)
project_level?
end
def project_level?
......
......@@ -145,35 +145,29 @@ RSpec.describe Integration do
describe '#can_test?' do
subject { integration.can_test? }
context 'when repository is not empty' do
let(:project) { build(:project, :repository) }
it { is_expected.to be true }
end
context 'when repository is empty' do
let(:project) { build(:project) }
context 'when project-level integration' do
let(:project) { create(:project) }
it { is_expected.to be true }
end
context 'when instance-level service' do
context 'when instance-level integration' do
Integration.available_integration_types.each do |type|
let(:integration) do
described_class.send(:integration_type_to_model, type).new(instance: true)
end
it { is_expected.to be_falsey }
it { is_expected.to be false }
end
end
context 'when group-level service' do
context 'when group-level integration' do
Integration.available_integration_types.each do |type|
let(:integration) do
described_class.send(:integration_type_to_model, type).new(group_id: group.id)
end
it { is_expected.to be_falsey }
it { is_expected.to be false }
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