diff options
author | Sean McGivern <sean@gitlab.com> | 2019-06-24 09:20:10 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-06-24 09:20:10 +0000 |
commit | e6532ca203a9f29294ebbc854e7c6372f76799dd (patch) | |
tree | a610b009356413d1a9ade1402c3b902186d26e07 /spec/support/shared_examples | |
parent | 6177bc1d69ca4870672a9db1af3b5f6798674676 (diff) | |
download | gitlab-ce-e6532ca203a9f29294ebbc854e7c6372f76799dd.tar.gz |
Fix notes email with group-level notification email
A Noteable doesn't have a group directly, unless it's an epic - we need
to look for the project's group to find the right email address.
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/notify_shared_examples.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/support/shared_examples/notify_shared_examples.rb b/spec/support/shared_examples/notify_shared_examples.rb index 6894a63ce42..e64c7e37a0c 100644 --- a/spec/support/shared_examples/notify_shared_examples.rb +++ b/spec/support/shared_examples/notify_shared_examples.rb @@ -45,18 +45,18 @@ shared_examples 'an email sent to a user' do let(:group_notification_email) { 'user+group@example.com' } it 'is sent to user\'s global notification email address' do - expect(subject).to deliver_to(test_recipient.notification_email) + expect(subject).to deliver_to(recipient.notification_email) end context 'that is part of a project\'s group' do it 'is sent to user\'s group notification email address when set' do - create(:notification_setting, user: test_recipient, source: project.group, notification_email: group_notification_email) + create(:notification_setting, user: recipient, source: project.group, notification_email: group_notification_email) expect(subject).to deliver_to(group_notification_email) end it 'is sent to user\'s global notification email address when no group email set' do - create(:notification_setting, user: test_recipient, source: project.group, notification_email: '') - expect(subject).to deliver_to(test_recipient.notification_email) + create(:notification_setting, user: recipient, source: project.group, notification_email: '') + expect(subject).to deliver_to(recipient.notification_email) end end @@ -67,17 +67,17 @@ shared_examples 'an email sent to a user' do it 'is sent to user\'s subgroup notification email address when set' do # Set top-level group notification email address to make sure it doesn't get selected - create(:notification_setting, user: test_recipient, source: group, notification_email: group_notification_email) + create(:notification_setting, user: recipient, source: group, notification_email: group_notification_email) subgroup_notification_email = 'user+subgroup@example.com' - create(:notification_setting, user: test_recipient, source: subgroup, notification_email: subgroup_notification_email) + create(:notification_setting, user: recipient, source: subgroup, notification_email: subgroup_notification_email) expect(subject).to deliver_to(subgroup_notification_email) end it 'is sent to user\'s group notification email address when set and subgroup email address not set' do - create(:notification_setting, user: test_recipient, source: subgroup, notification_email: '') - expect(subject).to deliver_to(test_recipient.notification_email) + create(:notification_setting, user: recipient, source: subgroup, notification_email: '') + expect(subject).to deliver_to(recipient.notification_email) end end end |