Commit a210554a authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

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

Rename project integration associations: FHI [RUN ALL RSPEC]

See merge request gitlab-org/gitlab!64031
parents 92a5becc 68658c2e
...@@ -45,6 +45,9 @@ class Integration < ApplicationRecord ...@@ -45,6 +45,9 @@ class Integration < ApplicationRecord
campfire confluence custom_issue_tracker campfire confluence custom_issue_tracker
datadog discord drone_ci datadog discord drone_ci
emails_on_push ewm emails_on_push external_wiki emails_on_push ewm emails_on_push external_wiki
flowdock
hangouts_chat
irker
].to_set.freeze ].to_set.freeze
def self.renamed?(name) def self.renamed?(name)
......
...@@ -169,9 +169,9 @@ class Project < ApplicationRecord ...@@ -169,9 +169,9 @@ class Project < ApplicationRecord
has_one :emails_on_push_integration, class_name: 'Integrations::EmailsOnPush' has_one :emails_on_push_integration, class_name: 'Integrations::EmailsOnPush'
has_one :ewm_integration, class_name: 'Integrations::Ewm' has_one :ewm_integration, class_name: 'Integrations::Ewm'
has_one :external_wiki_integration, class_name: 'Integrations::ExternalWiki' 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 :hangouts_chat_integration, class_name: 'Integrations::HangoutsChat'
has_one :irker_service, class_name: 'Integrations::Irker' has_one :irker_integration, class_name: 'Integrations::Irker'
has_one :jenkins_service, class_name: 'Integrations::Jenkins' has_one :jenkins_service, class_name: 'Integrations::Jenkins'
has_one :jira_service, class_name: 'Integrations::Jira' has_one :jira_service, class_name: 'Integrations::Jira'
has_one :mattermost_service, class_name: 'Integrations::Mattermost' has_one :mattermost_service, class_name: 'Integrations::Mattermost'
......
...@@ -370,17 +370,17 @@ project: ...@@ -370,17 +370,17 @@ project:
- pipelines_email_service - pipelines_email_service
- mattermost_slash_commands_service - mattermost_slash_commands_service
- slack_slash_commands_service - slack_slash_commands_service
- irker_service - irker_integration
- packagist_service - packagist_service
- pivotaltracker_service - pivotaltracker_service
- prometheus_service - prometheus_service
- flowdock_service - flowdock_integration
- assembla_integration - assembla_integration
- asana_integration - asana_integration
- slack_service - slack_service
- microsoft_teams_service - microsoft_teams_service
- mattermost_service - mattermost_service
- hangouts_chat_service - hangouts_chat_integration
- unify_circuit_service - unify_circuit_service
- buildkite_integration - buildkite_integration
- bamboo_integration - bamboo_integration
......
...@@ -29,27 +29,29 @@ RSpec.describe Integrations::Flowdock do ...@@ -29,27 +29,29 @@ RSpec.describe Integrations::Flowdock do
describe "Execute" do describe "Execute" do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
let(:api_url) { 'https://api.flowdock.com/v1/messages' }
subject(:flowdock_integration) { described_class.new }
before do before do
@flowdock_service = described_class.new allow(flowdock_integration).to receive_messages(
allow(@flowdock_service).to receive_messages(
project_id: project.id, project_id: project.id,
project: project, project: project,
service_hook: true, service_hook: true,
token: 'verySecret' token: 'verySecret'
) )
@sample_data = Gitlab::DataBuilder::Push.build_sample(project, user) WebMock.stub_request(:post, api_url)
@api_url = 'https://api.flowdock.com/v1/messages'
WebMock.stub_request(:post, @api_url)
end end
it "calls FlowDock API" do it "calls FlowDock API" do
@flowdock_service.execute(@sample_data) flowdock_integration.execute(sample_data)
@sample_data[:commits].each do |commit|
sample_data[:commits].each do |commit|
# One request to Flowdock per new 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}/ body: /#{commit[:id]}.*#{project.path}/
).once ).once
end end
......
...@@ -38,7 +38,7 @@ RSpec.describe Project, factory_default: :keep do ...@@ -38,7 +38,7 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_one(:slack_service) } it { is_expected.to have_one(:slack_service) }
it { is_expected.to have_one(:microsoft_teams_service) } it { is_expected.to have_one(:microsoft_teams_service) }
it { is_expected.to have_one(:mattermost_service) } it { is_expected.to have_one(:mattermost_service) }
it { is_expected.to have_one(:hangouts_chat_service) } it { is_expected.to have_one(:hangouts_chat_integration) }
it { is_expected.to have_one(:unify_circuit_service) } it { is_expected.to have_one(:unify_circuit_service) }
it { is_expected.to have_one(:webex_teams_service) } it { is_expected.to have_one(:webex_teams_service) }
it { is_expected.to have_one(:packagist_service) } it { is_expected.to have_one(:packagist_service) }
...@@ -51,9 +51,9 @@ RSpec.describe Project, factory_default: :keep do ...@@ -51,9 +51,9 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_one(:drone_ci_integration) } it { is_expected.to have_one(:drone_ci_integration) }
it { is_expected.to have_one(:emails_on_push_integration) } 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(:pipelines_email_service) }
it { is_expected.to have_one(:irker_service) } it { is_expected.to have_one(:irker_integration) }
it { is_expected.to have_one(:pivotaltracker_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(:assembla_integration) }
it { is_expected.to have_one(:slack_slash_commands_service) } it { is_expected.to have_one(:slack_slash_commands_service) }
it { is_expected.to have_one(:mattermost_slash_commands_service) } it { is_expected.to have_one(:mattermost_slash_commands_service) }
......
...@@ -317,7 +317,7 @@ RSpec.describe API::Services do ...@@ -317,7 +317,7 @@ RSpec.describe API::Services do
end end
before do before do
project.create_hangouts_chat_service( project.create_hangouts_chat_integration(
active: true, active: true,
properties: params properties: params
) )
......
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