summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-03-14 21:08:56 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-03-14 21:08:56 +0800
commit4e1f19257621a7653e3ae5dd7e0d85bab0a8f699 (patch)
tree0efb70db6d2dcca8cf232e06990efaa9620be0f2
parent423aac61ca62526d2c2cbfd14741e2f5c9697b66 (diff)
downloadgitlab-ce-enable-successful-pipeline-emails-only-with-custom-level.tar.gz
-rw-r--r--changelogs/unreleased/enable-successful-pipeline-emails-only-with-custom-level.yml5
-rw-r--r--spec/workers/pipeline_notification_worker_spec.rb48
2 files changed, 30 insertions, 23 deletions
diff --git a/changelogs/unreleased/enable-successful-pipeline-emails-only-with-custom-level.yml b/changelogs/unreleased/enable-successful-pipeline-emails-only-with-custom-level.yml
new file mode 100644
index 00000000000..1e2c15edaa9
--- /dev/null
+++ b/changelogs/unreleased/enable-successful-pipeline-emails-only-with-custom-level.yml
@@ -0,0 +1,5 @@
+---
+title: Make it that the only way to turn on successful pipeline emails would be using
+ custom notification with successful pipeline on
+merge_request: 9907
+author:
diff --git a/spec/workers/pipeline_notification_worker_spec.rb b/spec/workers/pipeline_notification_worker_spec.rb
index 8b0acf578e3..9fe25e55e16 100644
--- a/spec/workers/pipeline_notification_worker_spec.rb
+++ b/spec/workers/pipeline_notification_worker_spec.rb
@@ -17,6 +17,9 @@ describe PipelineNotificationWorker do
let(:watcher) { pusher }
describe '#execute' do
+ let(:status) { 'success' }
+ let(:email_subject) { "Pipeline ##{pipeline.id} has succeeded" }
+
before do
reset_delivered_emails!
pipeline.project.team << [pusher, Gitlab::Access::DEVELOPER]
@@ -44,8 +47,6 @@ describe PipelineNotificationWorker do
end
context 'with success pipeline' do
- let(:status) { 'success' }
- let(:email_subject) { "Pipeline ##{pipeline.id} has succeeded" }
let(:receivers) { [pusher] }
context 'with custom notification success pipeline on' do
@@ -56,36 +57,37 @@ describe PipelineNotificationWorker do
it_behaves_like 'sending emails'
end
+ end
- context 'with failed pipeline' do
- let(:status) { 'failed' }
- let(:email_subject) { "Pipeline ##{pipeline.id} has failed" }
-
- it_behaves_like 'sending emails'
+ context 'with failed pipeline' do
+ let(:status) { 'failed' }
+ let(:email_subject) { "Pipeline ##{pipeline.id} has failed" }
+ let(:receivers) { [pusher, watcher] }
- context 'with pipeline from someone else' do
- let(:pusher) { create(:user) }
- let(:watcher) { user }
+ it_behaves_like 'sending emails'
- context 'with failed pipeline notification on' do
- before do
- watcher.global_notification_setting
- .update(level: 'custom', failed_pipeline: true)
- end
+ context 'with pipeline from someone else' do
+ let(:pusher) { create(:user) }
+ let(:watcher) { user }
- it_behaves_like 'sending emails'
+ context 'with failed pipeline notification on' do
+ before do
+ watcher.global_notification_setting
+ .update(level: 'custom', failed_pipeline: true)
end
- context 'with failed pipeline notification off' do
- let(:receivers) { [pusher] }
+ it_behaves_like 'sending emails'
+ end
- before do
- watcher.global_notification_setting
- .update(level: 'custom', failed_pipeline: false)
- end
+ context 'with failed pipeline notification off' do
+ let(:receivers) { [pusher] }
- it_behaves_like 'sending emails'
+ before do
+ watcher.global_notification_setting
+ .update(level: 'custom', failed_pipeline: false)
end
+
+ it_behaves_like 'sending emails'
end
end
end