Commit ff0c513e authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'andysoiron/add-chat-integration-deployment-test' into 'master'

Add test for chat integration deployment events

See merge request gitlab-org/gitlab!76785
parents 098b4071 88a99594
...@@ -3,6 +3,17 @@ ...@@ -3,6 +3,17 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Integrations::MicrosoftTeams do RSpec.describe Integrations::MicrosoftTeams do
it_behaves_like "chat integration", "Microsoft Teams" do
let(:client) { ::MicrosoftTeams::Notifier }
let(:client_arguments) { webhook_url }
let(:payload) do
{
summary: be_present
}
end
end
let(:chat_integration) { described_class.new } let(:chat_integration) { described_class.new }
let(:webhook_url) { 'https://example.gitlab.com/' } let(:webhook_url) { 'https://example.gitlab.com/' }
......
...@@ -71,7 +71,7 @@ RSpec.shared_examples "chat integration" do |integration_name| ...@@ -71,7 +71,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
it "does not call #{integration_name} API" do it "does not call #{integration_name} API" do
result = subject.execute(sample_data) result = subject.execute(sample_data)
expect(result).to be(false) expect(result).to be_falsy
expect(WebMock).not_to have_requested(:post, webhook_url) expect(WebMock).not_to have_requested(:post, webhook_url)
end end
end end
...@@ -355,5 +355,11 @@ RSpec.shared_examples "chat integration" do |integration_name| ...@@ -355,5 +355,11 @@ RSpec.shared_examples "chat integration" do |integration_name|
end end
end end
end end
context 'deployment events' do
let(:sample_data) { Gitlab::DataBuilder::Deployment.build(create(:deployment), Time.now) }
it_behaves_like "untriggered #{integration_name} integration"
end
end end
end 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