Skip to content
Snippets Groups Projects
Commit dbedacb3 authored by Alexis Kalderimis's avatar Alexis Kalderimis :speech_balloon:
Browse files

Rename microsoft_teams_service to integration

Rename the projection association from microsoft_teams_service to
microsoft_teams_integration
parent 2ae8a1e7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -49,7 +49,7 @@ class Integration < ApplicationRecord
hangouts_chat
irker
packagist pipelines_email pivotaltracker pushover
mattermost
mattermost mattermost_slash_commands microsoft_teams
].to_set.freeze
 
def self.renamed?(name)
Loading
Loading
Loading
Loading
@@ -176,7 +176,7 @@ def self.integration_association_name(name)
has_one :jira_service, class_name: 'Integrations::Jira'
has_one :mattermost_integration, class_name: 'Integrations::Mattermost'
has_one :mattermost_slash_commands_integration, class_name: 'Integrations::MattermostSlashCommands'
has_one :microsoft_teams_service, class_name: 'Integrations::MicrosoftTeams'
has_one :microsoft_teams_integration, class_name: 'Integrations::MicrosoftTeams'
has_one :mock_ci_service, class_name: 'Integrations::MockCi'
has_one :packagist_integration, class_name: 'Integrations::Packagist'
has_one :pipelines_email_integration, class_name: 'Integrations::PipelinesEmail'
Loading
Loading
Loading
Loading
@@ -44,10 +44,10 @@
let(:project) { create(:project) }
 
context 'with chat notification service' do
let(:service) { project.create_microsoft_teams_service(webhook: 'http://webhook.com') }
let(:service) { project.create_microsoft_teams_integration(webhook: 'http://webhook.com') }
 
it 'returns success' do
allow_any_instance_of(::MicrosoftTeams::Notifier).to receive(:ping).and_return(true)
allow_next(::MicrosoftTeams::Notifier).to receive(:ping).and_return(true)
 
put :test, params: project_params
 
Loading
Loading
Loading
Loading
@@ -378,7 +378,7 @@ project:
- assembla_integration
- asana_integration
- slack_service
- microsoft_teams_service
- microsoft_teams_integration
- mattermost_integration
- hangouts_chat_integration
- unify_circuit_service
Loading
Loading
Loading
Loading
@@ -64,7 +64,8 @@
end
 
it 'specifies the webhook when it is configured' do
expect(::MicrosoftTeams::Notifier).to receive(:new).with(webhook_url).and_return(double(:microsoft_teams_service).as_null_object)
integration = double(:microsoft_teams_integration).as_null_object
expect(::MicrosoftTeams::Notifier).to receive(:new).with(webhook_url).and_return(integration)
 
chat_service.execute(push_sample_data)
end
Loading
Loading
Loading
Loading
@@ -36,7 +36,7 @@
it { is_expected.to have_many(:protected_branches) }
it { is_expected.to have_many(:exported_protected_branches) }
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_integration) }
it { is_expected.to have_one(:mattermost_integration) }
it { is_expected.to have_one(:hangouts_chat_integration) }
it { is_expected.to have_one(:unify_circuit_service) }
Loading
Loading
Loading
Loading
@@ -275,8 +275,8 @@ def deactive_service!
end
end
 
describe 'Microsoft Teams service' do
let(:service_name) { 'microsoft-teams' }
describe 'Microsoft Teams integration' do
let(:integration_name) { 'microsoft-teams' }
let(:params) do
{
webhook: 'https://hook.example.com',
Loading
Loading
@@ -286,21 +286,23 @@ def deactive_service!
end
 
before do
project.create_microsoft_teams_service(
project.create_microsoft_teams_integration(
active: true,
properties: params
)
end
 
it 'accepts branches_to_be_notified for update' do
put api("/projects/#{project.id}/services/#{service_name}", user), params: params.merge(branches_to_be_notified: 'all')
put api("/projects/#{project.id}/services/#{integration_name}", user),
params: params.merge(branches_to_be_notified: 'all')
 
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['branches_to_be_notified']).to eq('all')
end
 
it 'accepts notify_only_broken_pipelines for update' do
put api("/projects/#{project.id}/services/#{service_name}", user), params: params.merge(notify_only_broken_pipelines: true)
put api("/projects/#{project.id}/services/#{integration_name}", user),
params: params.merge(notify_only_broken_pipelines: true)
 
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['notify_only_broken_pipelines']).to eq(true)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment