Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-03-23 10:16:48 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-03-23 15:35:20 +0300
commit091c2608129445c6fe2dbe9a59e5fd3c78103d94 (patch)
tree047e20308c620e1c2d0a1955f490d3394aeec502 /spec/support/slack_mattermost_notifications_shared_examples.rb
parentfed319b4ab763790865835eca35d179294883dd2 (diff)
Improve readability and add test
Diffstat (limited to 'spec/support/slack_mattermost_notifications_shared_examples.rb')
-rw-r--r--spec/support/slack_mattermost_notifications_shared_examples.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support/slack_mattermost_notifications_shared_examples.rb b/spec/support/slack_mattermost_notifications_shared_examples.rb
index 704922b6cf4..b902fe90707 100644
--- a/spec/support/slack_mattermost_notifications_shared_examples.rb
+++ b/spec/support/slack_mattermost_notifications_shared_examples.rb
@@ -324,5 +324,24 @@ RSpec.shared_examples 'slack or mattermost notifications' do
it_behaves_like 'call Slack/Mattermost API'
end
end
+
+ context 'only notify for the default branch' do
+ context 'when enabled' do
+ let(:pipeline) do
+ create(:ci_pipeline, project: project, status: 'failed', ref: 'not-the-default-branch')
+ end
+
+ before do
+ chat_service.notify_only_default_branch = true
+ end
+
+ it 'does not call the Slack/Mattermost API for pipeline events' do
+ data = Gitlab::DataBuilder::Pipeline.build(pipeline)
+ result = chat_service.execute(data)
+
+ expect(result).to be_falsy
+ end
+ end
+ end
end
end