diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-10-18 20:02:35 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-10-18 20:02:35 +0800 |
commit | 045c6715330d25adff95304a3de908037c63a163 (patch) | |
tree | 23ed554dd0eed9a2088c1ecf49dd096b77f8a368 /spec/workers | |
parent | 12ef494db812de3790ad5f42152f9b3fdf8c9f3c (diff) | |
download | gitlab-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.rb | 14 |
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 |