Commit 8d34afe0 authored by Alex Kalderimis's avatar Alex Kalderimis

Change flowdock_service to flowdock_integration

Rename project association from flowdock_service to flowdock_integration
parent 6d0519eb
......@@ -45,6 +45,7 @@ class Integration < ApplicationRecord
campfire confluence custom_issue_tracker
datadog discord drone_ci
emails_on_push ewm emails_on_push external_wiki
flowdock
].to_set.freeze
def self.renamed?(name)
......
......@@ -169,7 +169,7 @@ class Project < ApplicationRecord
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 :flowdock_integration, class_name: 'Integrations::Flowdock'
has_one :hangouts_chat_service, class_name: 'Integrations::HangoutsChat'
has_one :irker_service, class_name: 'Integrations::Irker'
has_one :jenkins_service, class_name: 'Integrations::Jenkins'
......
......@@ -374,7 +374,7 @@ project:
- packagist_service
- pivotaltracker_service
- prometheus_service
- flowdock_service
- flowdock_integration
- assembla_integration
- asana_integration
- slack_service
......
......@@ -29,27 +29,27 @@ RSpec.describe Integrations::Flowdock do
describe "Execute" do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:flowdock_integration) { subject }
let(:sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
let(:api_url) { 'https://api.flowdock.com/v1/messages' }
before do
@flowdock_service = described_class.new
allow(@flowdock_service).to receive_messages(
allow(flowdock_integration).to receive_messages(
project_id: project.id,
project: project,
service_hook: true,
token: 'verySecret'
)
@sample_data = Gitlab::DataBuilder::Push.build_sample(project, user)
@api_url = 'https://api.flowdock.com/v1/messages'
WebMock.stub_request(:post, @api_url)
WebMock.stub_request(:post, api_url)
end
it "calls FlowDock API" do
@flowdock_service.execute(@sample_data)
@sample_data[:commits].each do |commit|
flowdock_integration.execute(sample_data)
sample_data[:commits].each do |commit|
# One request to Flowdock per new commit
next if commit[:id] == @sample_data[:before]
next if commit[:id] == sample_data[:before]
expect(WebMock).to have_requested(:post, @api_url).with(
expect(WebMock).to have_requested(:post, api_url).with(
body: /#{commit[:id]}.*#{project.path}/
).once
end
......
......@@ -53,7 +53,7 @@ RSpec.describe Project, factory_default: :keep do
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) }
it { is_expected.to have_one(:flowdock_service) }
it { is_expected.to have_one(:flowdock_integration) }
it { is_expected.to have_one(:assembla_integration) }
it { is_expected.to have_one(:slack_slash_commands_service) }
it { is_expected.to have_one(:mattermost_slash_commands_service) }
......
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