Commit 6d0519eb authored by Stan Hu's avatar Stan Hu

Merge branch '330300-ajk-e' into 'master'

Rename project integration associations: E

See merge request gitlab-org/gitlab!64026
parents 1533ddec 88c097c7
......@@ -44,6 +44,7 @@ class Integration < ApplicationRecord
bamboo bugzilla buildkite
campfire confluence custom_issue_tracker
datadog discord drone_ci
emails_on_push ewm emails_on_push external_wiki
].to_set.freeze
def self.renamed?(name)
......
......@@ -166,9 +166,9 @@ class Project < ApplicationRecord
has_one :datadog_integration, class_name: 'Integrations::Datadog'
has_one :discord_integration, class_name: 'Integrations::Discord'
has_one :drone_ci_integration, class_name: 'Integrations::DroneCi'
has_one :emails_on_push_service, class_name: 'Integrations::EmailsOnPush'
has_one :ewm_service, class_name: 'Integrations::Ewm'
has_one :external_wiki_service, class_name: 'Integrations::ExternalWiki'
has_one :emails_on_push_integration, class_name: 'Integrations::EmailsOnPush'
has_one :ewm_integration, class_name: 'Integrations::Ewm'
has_one :external_wiki_integration, class_name: 'Integrations::ExternalWiki'
has_one :flowdock_service, class_name: 'Integrations::Flowdock'
has_one :hangouts_chat_service, class_name: 'Integrations::HangoutsChat'
has_one :irker_service, class_name: 'Integrations::Irker'
......
......@@ -12,7 +12,7 @@ FactoryBot.define do
issue_tracker
end
factory :emails_on_push_service, class: 'Integrations::EmailsOnPush' do
factory :emails_on_push_integration, class: 'Integrations::EmailsOnPush' do
project
type { 'EmailsOnPushService' }
active { true }
......@@ -103,7 +103,7 @@ FactoryBot.define do
issue_tracker
end
factory :ewm_service, class: 'Integrations::Ewm' do
factory :ewm_integration, class: 'Integrations::Ewm' do
project
active { true }
issue_tracker
......@@ -127,7 +127,7 @@ FactoryBot.define do
end
end
factory :external_wiki_service, class: 'Integrations::ExternalWiki' do
factory :external_wiki_integration, class: 'Integrations::ExternalWiki' do
project
type { 'ExternalWikiService' }
active { true }
......
......@@ -426,7 +426,7 @@ FactoryBot.define do
factory :ewm_project, parent: :project do
has_external_issue_tracker { true }
ewm_service
ewm_integration
end
factory :project_with_design, parent: :project do
......
......@@ -213,7 +213,9 @@ RSpec.describe Banzai::Filter::References::ExternalIssueReferenceFilter do
end
context "ewm project" do
let_it_be(:service) { create(:ewm_service, project: project) }
let_it_be(:integration) { create(:ewm_integration, project: project) }
let(:service) { integration } # TODO: remove when https://gitlab.com/gitlab-org/gitlab/-/issues/330300 is complete
before do
project.update!(issues_enabled: false)
......
......@@ -366,7 +366,7 @@ project:
- datadog_integration
- discord_integration
- drone_ci_integration
- emails_on_push_service
- emails_on_push_integration
- pipelines_email_service
- mattermost_slash_commands_service
- slack_slash_commands_service
......@@ -391,8 +391,8 @@ project:
- youtrack_service
- custom_issue_tracker_integration
- bugzilla_integration
- ewm_service
- external_wiki_service
- ewm_integration
- external_wiki_integration
- mock_ci_service
- mock_monitoring_service
- forked_to_members
......
......@@ -19,7 +19,7 @@ RSpec.describe Sidebars::Projects::Menus::ExternalWikiMenu do
end
context 'when active external issue tracker' do
let(:external_wiki) { build(:external_wiki_service, project: project) }
let(:external_wiki) { build(:external_wiki_integration, project: project) }
context 'is present' do
it 'returns true' do
......
......@@ -88,7 +88,7 @@ RSpec.describe Integrations::EmailsOnPush do
describe '#execute' do
let(:push_data) { { object_kind: 'push' } }
let(:project) { create(:project, :repository) }
let(:service) { create(:emails_on_push_service, project: project) }
let(:integration) { create(:emails_on_push_integration, project: project) }
let(:recipients) { 'test@gitlab.com' }
before do
......@@ -105,7 +105,7 @@ RSpec.describe Integrations::EmailsOnPush do
it 'sends email' do
expect(EmailsOnPushWorker).not_to receive(:perform_async)
service.execute(push_data)
integration.execute(push_data)
end
end
......@@ -119,7 +119,7 @@ RSpec.describe Integrations::EmailsOnPush do
it 'does not send email' do
expect(EmailsOnPushWorker).not_to receive(:perform_async)
service.execute(push_data)
integration.execute(push_data)
end
end
......@@ -128,7 +128,7 @@ RSpec.describe Integrations::EmailsOnPush do
expect(project).to receive(:emails_disabled?).and_return(true)
expect(EmailsOnPushWorker).not_to receive(:perform_async)
service.execute(push_data)
integration.execute(push_data)
end
end
......
......@@ -49,7 +49,7 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_one(:datadog_integration) }
it { is_expected.to have_one(:discord_integration) }
it { is_expected.to have_one(:drone_ci_integration) }
it { is_expected.to have_one(:emails_on_push_service) }
it { is_expected.to have_one(:emails_on_push_integration) }
it { is_expected.to have_one(:pipelines_email_service) }
it { is_expected.to have_one(:irker_service) }
it { is_expected.to have_one(:pivotaltracker_service) }
......@@ -65,8 +65,8 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_one(:youtrack_service) }
it { is_expected.to have_one(:custom_issue_tracker_integration) }
it { is_expected.to have_one(:bugzilla_integration) }
it { is_expected.to have_one(:ewm_service) }
it { is_expected.to have_one(:external_wiki_service) }
it { is_expected.to have_one(:ewm_integration) }
it { is_expected.to have_one(:external_wiki_integration) }
it { is_expected.to have_one(:confluence_integration) }
it { is_expected.to have_one(:project_feature) }
it { is_expected.to have_one(:project_repository) }
......
......@@ -25,8 +25,8 @@ RSpec.describe API::Services do
end
context 'project with services' do
let!(:active_service) { create(:emails_on_push_service, project: project, active: true) }
let!(:service) { create(:custom_issue_tracker_integration, project: project, active: false) }
let!(:active_integration) { create(:emails_on_push_integration, project: project, active: true) }
let!(:integration) { create(:custom_issue_tracker_integration, project: project, active: false) }
it "returns a list of all active services" do
get api("/projects/#{project.id}/services", user)
......
......@@ -5,15 +5,15 @@ require 'spec_helper'
RSpec.describe ServiceEventEntity do
let(:request) { double('request') }
subject { described_class.new(event, request: request, service: service).as_json }
subject { described_class.new(event, request: request, service: integration).as_json }
before do
allow(request).to receive(:service).and_return(service)
allow(request).to receive(:service).and_return(integration)
end
describe '#as_json' do
context 'service without fields' do
let(:service) { create(:emails_on_push_service, push_events: true) }
let(:integration) { create(:emails_on_push_integration, push_events: true) }
let(:event) { 'push' }
it 'exposes correct attributes' do
......@@ -25,7 +25,7 @@ RSpec.describe ServiceEventEntity do
end
context 'service with fields' do
let(:service) { create(:slack_service, note_events: false, note_channel: 'note-channel') }
let(:integration) { create(:slack_service, note_events: false, note_channel: 'note-channel') }
let(:event) { 'note' }
it 'exposes correct attributes' do
......
......@@ -55,10 +55,11 @@ RSpec.describe ServiceFieldEntity do
end
context 'EmailsOnPush Service' do
let(:service) { create(:emails_on_push_service, send_from_committer_email: '1') }
let(:integration) { create(:emails_on_push_integration, send_from_committer_email: '1') }
let(:service) { integration } # TODO: remove when https://gitlab.com/gitlab-org/gitlab/-/issues/330300 is complete
context 'field with type checkbox' do
let(:field) { service.global_fields.find { |field| field[:name] == 'send_from_committer_email' } }
let(:field) { integration.global_fields.find { |field| field[:name] == 'send_from_committer_email' } }
it 'exposes correct attributes and casts value to Boolean' do
expected_hash = {
......@@ -77,7 +78,7 @@ RSpec.describe ServiceFieldEntity do
end
context 'field with type select' do
let(:field) { service.global_fields.find { |field| field[:name] == 'branches_to_be_notified' } }
let(:field) { integration.global_fields.find { |field| field[:name] == 'branches_to_be_notified' } }
it 'exposes correct attributes' do
expected_hash = {
......
......@@ -1061,7 +1061,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
let(:service_status) { true }
before do
project.create_external_wiki_service(active: service_status, properties: properties)
project.create_external_wiki_integration(active: service_status, properties: properties)
project.reload
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