summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-10-18 20:02:35 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-10-18 20:02:35 +0800
commit045c6715330d25adff95304a3de908037c63a163 (patch)
tree23ed554dd0eed9a2088c1ecf49dd096b77f8a368 /spec/workers
parent12ef494db812de3790ad5f42152f9b3fdf8c9f3c (diff)
downloadgitlab-ce-045c6715330d25adff95304a3de908037c63a163.tar.gz
Use bcc for pipeline emails because:
We use bcc here because we don't want to generate this emails for a thousand times. This could be potentially expensive in a loop, and recipients would contain all project watchers so it could be a lot.
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/pipeline_notification_worker_spec.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/spec/workers/pipeline_notification_worker_spec.rb b/spec/workers/pipeline_notification_worker_spec.rb
index c641d7a7801..c334b2057a6 100644
--- a/spec/workers/pipeline_notification_worker_spec.rb
+++ b/spec/workers/pipeline_notification_worker_spec.rb
@@ -26,15 +26,13 @@ describe PipelineNotificationWorker do
subject.perform(pipeline.id)
end
- expected_receivers = [pusher, watcher].uniq.sort_by(&:email)
- actual = ActionMailer::Base.deliveries.sort_by(&:to)
+ emails = ActionMailer::Base.deliveries
+ actual = emails.flat_map(&:bcc).sort
+ expected_receivers = [pusher, watcher].map(&:email).uniq.sort
- expect(expected_receivers.size).to eq(actual.size)
-
- actual.zip(expected_receivers).each do |(email, receiver)|
- expect(email.subject).to include(email_subject)
- expect(email.to).to eq([receiver.email])
- end
+ expect(actual).to eq(expected_receivers)
+ expect(emails.size).to eq(1)
+ expect(emails.last.subject).to include(email_subject)
end
end