From 1a402d888c05196212d1ba671368837e85246c9c Mon Sep 17 00:00:00 2001 From: Wei-Meng Lee Date: Sat, 16 Feb 2019 01:56:13 +0800 Subject: Send notifications to group-specific email address - Select notification email by walking up group/subgroup path - Add settings UI to set group email notification address - Add tests --- spec/mailers/emails/pages_domains_spec.rb | 6 ++++-- spec/mailers/notify_spec.rb | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'spec/mailers') diff --git a/spec/mailers/emails/pages_domains_spec.rb b/spec/mailers/emails/pages_domains_spec.rb index 050af587061..2f594dbf9d1 100644 --- a/spec/mailers/emails/pages_domains_spec.rb +++ b/spec/mailers/emails/pages_domains_spec.rb @@ -5,11 +5,13 @@ describe Emails::PagesDomains do include EmailSpec::Matchers include_context 'gitlab email notification' - set(:project) { create(:project) } set(:domain) { create(:pages_domain, project: project) } - set(:user) { project.owner } + set(:user) { project.creator } shared_examples 'a pages domain email' do + let(:test_recipient) { user } + + it_behaves_like 'an email sent to a user' it_behaves_like 'an email sent from GitLab' it_behaves_like 'it should not have Gmail Actions links' it_behaves_like 'a user cannot unsubscribe through footer link' diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 8f348b1b053..67c1aa69db4 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -45,6 +45,10 @@ describe Notify do context 'for a project' do shared_examples 'an assignee email' do + let(:test_recipient) { assignee } + + it_behaves_like 'an email sent to a user' + it 'is sent to the assignee as the author' do sender = subject.header[:from].addrs.first @@ -618,8 +622,10 @@ describe Notify do end describe 'project was moved' do + let(:test_recipient) { user } subject { described_class.project_was_moved_email(project.id, user.id, "gitlab/gitlab") } + it_behaves_like 'an email sent to a user' it_behaves_like 'an email sent from GitLab' it_behaves_like 'it should not have Gmail Actions links' it_behaves_like "a user cannot unsubscribe through footer link" @@ -1083,8 +1089,6 @@ describe Notify do end context 'for a group' do - set(:group) { create(:group) } - describe 'group access requested' do let(:group) { create(:group, :public, :access_requestable) } let(:group_member) do -- cgit v1.2.3