diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 09:08:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 09:08:32 +0000 |
commit | 9b984f55eef568b6a15c3a125e0cf66f35678e5a (patch) | |
tree | ee7e1eb42f27400dd74bb44bb595263af2d72fc1 /spec/support/shared_examples | |
parent | 83a9f472b8b523619519a1834176165c9f1532f7 (diff) | |
download | gitlab-ce-9b984f55eef568b6a15c3a125e0cf66f35678e5a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/services/notification_service_shared_examples.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/support/shared_examples/services/notification_service_shared_examples.rb b/spec/support/shared_examples/services/notification_service_shared_examples.rb index b4d52d24de4..43fe6789145 100644 --- a/spec/support/shared_examples/services/notification_service_shared_examples.rb +++ b/spec/support/shared_examples/services/notification_service_shared_examples.rb @@ -3,7 +3,7 @@ # Note that we actually update the attribute on the target_project/group, rather than # using `allow`. This is because there are some specs where, based on how the notification # is done, using an `allow` doesn't change the correct object. -RSpec.shared_examples 'project emails are disabled' do +RSpec.shared_examples 'project emails are disabled' do |check_delivery_jobs_queue: false| let(:target_project) { notification_target.is_a?(Project) ? notification_target : notification_target.project } before do @@ -16,7 +16,13 @@ RSpec.shared_examples 'project emails are disabled' do notification_trigger - should_not_email_anyone + if check_delivery_jobs_queue + # Only check enqueud jobs, not delivered emails + expect_no_delivery_jobs + else + # Deprecated: Check actual delivered emails + should_not_email_anyone + end end it 'sends emails to someone' do @@ -24,7 +30,13 @@ RSpec.shared_examples 'project emails are disabled' do notification_trigger - should_email_anyone + if check_delivery_jobs_queue + # Only check enqueud jobs, not delivered emails + expect_any_delivery_jobs + else + # Deprecated: Check actual delivered emails + should_email_anyone + end end end |