Commit b1bc22dd authored by Alex Kalderimis's avatar Alex Kalderimis

Rename emails_on_push service to integration

This renames references to the project association from
emails_on_push_service to emails_on_push_integration
parent 8cdb4f0d
......@@ -44,6 +44,7 @@ class Integration < ApplicationRecord
bamboo bugzilla buildkite
campfire confluence custom_issue_tracker
datadog discord drone_ci
emails_on_push
].to_set.freeze
def self.renamed?(name)
......
......@@ -166,7 +166,7 @@ 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 :emails_on_push_integration, class_name: 'Integrations::EmailsOnPush'
has_one :ewm_service, class_name: 'Integrations::Ewm'
has_one :external_wiki_service, class_name: 'Integrations::ExternalWiki'
has_one :flowdock_service, class_name: 'Integrations::Flowdock'
......
......@@ -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 }
......
......@@ -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
......
......@@ -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) }
......
......@@ -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)
......
......@@ -8,12 +8,12 @@ RSpec.describe ServiceEventEntity do
subject { described_class.new(event, request: request, service: service).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,10 @@ 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') }
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 +77,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 = {
......
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