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