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:
authorLin Jen-Shin <godfat@godfat.org>2016-10-18 15:02:35 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-10-18 15:02:35 +0300
commit045c6715330d25adff95304a3de908037c63a163 (patch)
tree23ed554dd0eed9a2088c1ecf49dd096b77f8a368 /spec/workers/pipeline_notification_worker_spec.rb
parent12ef494db812de3790ad5f42152f9b3fdf8c9f3c (diff)
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/pipeline_notification_worker_spec.rb')
-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