Commit ae766b0d authored by Alex Kalderimis's avatar Alex Kalderimis

Avoid factory conflict

This is not great, since it means the factory names are now
inconsistent, and it will be easy to use the wrong factory.

See: https://gitlab.com/gitlab-org/gitlab/-/issues/332331
parent acab00fe
......@@ -42,7 +42,7 @@ RSpec.describe EE::ServicesHelper do
end
context 'with Slack integration' do
let(:integration) { build(:slack_integration) }
let(:integration) { build(:integrations_slack) }
it 'does not include Jira specific fields' do
is_expected.not_to include(*jira_fields.keys)
......
......@@ -259,7 +259,7 @@ RSpec.describe Gitlab::UsageData do
for_defined_days_back do
user = create(:user)
project = create(:project, creator: user)
create(:slack_integration, project: project)
create(:integrations_slack, project: project)
create(:slack_slash_commands_integration, project: project)
create(:prometheus_service, project: project)
end
......
......@@ -130,7 +130,7 @@ RSpec.describe Projects::ServicesController do
end
context 'with the Slack integration' do
let_it_be(:integration) { build(:slack_integration) }
let_it_be(:integration) { build(:integrations_slack) }
let(:service) { integration } # TODO: remove when https://gitlab.com/gitlab-org/gitlab/-/issues/330300 is complete
......
......@@ -160,7 +160,8 @@ FactoryBot.define do
password { 'my-secret-password' }
end
factory :slack_integration, class: 'Integrations::Slack' do
# avoids conflict with slack_integration factory
factory :integrations_slack, class: 'Integrations::Slack' do
project
active { true }
webhook { 'https://slack.service.url' }
......
......@@ -23,7 +23,7 @@ RSpec.describe 'Admin visits service templates' do
context 'with an active service template' do
before do
create(:slack_integration, :template, active: true)
create(:integrations_slack, :template, active: true)
visit(admin_application_settings_services_path)
end
......@@ -40,7 +40,7 @@ RSpec.describe 'Admin visits service templates' do
context 'with instance-level integration' do
before do
create(:slack_integration, instance: true, project: nil)
create(:integrations_slack, instance: true, project: nil)
visit(admin_application_settings_services_path)
end
......
......@@ -37,7 +37,7 @@ RSpec.describe ServicesHelper do
subject { helper.integration_form_data(integration) }
context 'with Slack integration' do
let(:integration) { build(:slack_integration) }
let(:integration) { build(:integrations_slack) }
it { is_expected.to include(*fields) }
it { is_expected.not_to include(*jira_fields) }
......
......@@ -14,7 +14,7 @@ RSpec.describe HasIntegrations do
create(:jira_integration, project: project_2, inherit_from_id: nil)
create(:jira_integration, group: create(:group), project: nil, inherit_from_id: nil)
create(:jira_integration, project: project_3, inherit_from_id: nil)
create(:slack_integration, project: project_4, inherit_from_id: nil)
create(:integrations_slack, project: project_4, inherit_from_id: nil)
end
describe '.with_custom_integration_for' do
......
......@@ -569,7 +569,7 @@ RSpec.describe Group do
before do
create(:jira_integration, group: group, project: nil)
create(:slack_integration, group: another_group, project: nil)
create(:integrations_slack, group: another_group, project: nil)
end
it 'returns groups without integration' do
......
......@@ -10,7 +10,7 @@ RSpec.describe Integrations::Slack do
stub_request(:post, "https://slack.service.url/")
end
let_it_be(:slack_integration) { create(:slack_integration, branches_to_be_notified: 'all') }
let_it_be(:slack_integration) { create(:integrations_slack, branches_to_be_notified: 'all') }
it 'uses only known events', :aggregate_failures do
described_class::SUPPORTED_EVENTS_FOR_USAGE_LOG.each do |action|
......
......@@ -5369,7 +5369,7 @@ RSpec.describe Project, factory_default: :keep do
end
describe '#execute_services' do
let(:integration) { create(:slack_integration, push_events: true, merge_requests_events: false, active: true) }
let(:integration) { create(:integrations_slack, push_events: true, merge_requests_events: false, active: true) }
it 'executes integrations with the specified scope' do
data = 'any data'
......
......@@ -25,7 +25,7 @@ RSpec.describe ServiceEventEntity do
end
context 'integration with fields' do
let(:integration) { create(:slack_integration, note_events: false, note_channel: 'note-channel') }
let(:integration) { create(:integrations_slack, note_events: false, note_channel: 'note-channel') }
let(:event) { 'note' }
it 'exposes correct attributes' do
......
......@@ -241,7 +241,7 @@ RSpec.describe Groups::TransferService do
context 'when the group is allowed to be transferred' do
let_it_be(:new_parent_group, reload: true) { create(:group, :public) }
let_it_be(:new_parent_group_integration) { create(:slack_integration, group: new_parent_group, project: nil, webhook: 'http://new-group.slack.com') }
let_it_be(:new_parent_group_integration) { create(:integrations_slack, group: new_parent_group, project: nil, webhook: 'http://new-group.slack.com') }
before do
allow(PropagateIntegrationWorker).to receive(:perform_async)
......@@ -277,8 +277,8 @@ RSpec.describe Groups::TransferService do
let(:new_created_integration) { Integration.find_by(group: group) }
context 'with an inherited integration' do
let_it_be(:instance_integration) { create(:slack_integration, :instance, webhook: 'http://project.slack.com') }
let_it_be(:group_integration) { create(:slack_integration, group: group, project: nil, webhook: 'http://group.slack.com', inherit_from_id: instance_integration.id) }
let_it_be(:instance_integration) { create(:integrations_slack, :instance, webhook: 'http://project.slack.com') }
let_it_be(:group_integration) { create(:integrations_slack, group: group, project: nil, webhook: 'http://group.slack.com', inherit_from_id: instance_integration.id) }
it 'replaces inherited integrations', :aggregate_failures do
expect(new_created_integration.webhook).to eq(new_parent_group_integration.webhook)
......@@ -288,7 +288,7 @@ RSpec.describe Groups::TransferService do
end
context 'with a custom integration' do
let_it_be(:group_integration) { create(:slack_integration, group: group, project: nil, webhook: 'http://group.slack.com') }
let_it_be(:group_integration) { create(:integrations_slack, group: group, project: nil, webhook: 'http://group.slack.com') }
it 'does not updates the integrations', :aggregate_failures do
expect { transfer_service.execute(new_parent_group) }.not_to change { group_integration.webhook }
......
......@@ -8,7 +8,7 @@ RSpec.describe Integrations::Test::ProjectService do
describe '#execute' do
let_it_be(:project) { create(:project) }
let(:integration) { create(:slack_integration, project: project) }
let(:integration) { create(:integrations_slack, project: project) }
let(:user) { project.owner }
let(:event) { nil }
let(:sample_data) { { data: 'sample' } }
......
......@@ -7,7 +7,7 @@ RSpec.describe Projects::TransferService do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:group_integration) { create(:slack_integration, group: group, project: nil, webhook: 'http://group.slack.com') }
let_it_be(:group_integration) { create(:integrations_slack, group: group, project: nil, webhook: 'http://group.slack.com') }
let(:project) { create(:project, :repository, :legacy_storage, namespace: user.namespace) }
subject(:execute_transfer) { described_class.new(project, user).execute(group).tap { project.reload } }
......@@ -121,10 +121,10 @@ RSpec.describe Projects::TransferService do
context 'with a project integration' do
let_it_be_with_reload(:project) { create(:project, namespace: user.namespace) }
let_it_be(:instance_integration) { create(:slack_integration, :instance, webhook: 'http://project.slack.com') }
let_it_be(:instance_integration) { create(:integrations_slack, :instance, webhook: 'http://project.slack.com') }
context 'with an inherited integration' do
let_it_be(:project_integration) { create(:slack_integration, project: project, webhook: 'http://project.slack.com', inherit_from_id: instance_integration.id) }
let_it_be(:project_integration) { create(:integrations_slack, project: project, webhook: 'http://project.slack.com', inherit_from_id: instance_integration.id) }
it 'replaces inherited integrations', :aggregate_failures do
execute_transfer
......@@ -135,7 +135,7 @@ RSpec.describe Projects::TransferService do
end
context 'with a custom integration' do
let_it_be(:project_integration) { create(:slack_integration, project: project, webhook: 'http://project.slack.com') }
let_it_be(:project_integration) { create(:integrations_slack, project: project, webhook: 'http://project.slack.com') }
it 'does not updates the integrations' do
expect { execute_transfer }.not_to change { project.slack_integration.webhook }
......
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