diff options
Diffstat (limited to 'spec/mailers/emails/in_product_marketing_spec.rb')
-rw-r--r-- | spec/mailers/emails/in_product_marketing_spec.rb | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/spec/mailers/emails/in_product_marketing_spec.rb b/spec/mailers/emails/in_product_marketing_spec.rb index 3b92b049e42..720e6f101a8 100644 --- a/spec/mailers/emails/in_product_marketing_spec.rb +++ b/spec/mailers/emails/in_product_marketing_spec.rb @@ -5,29 +5,11 @@ require 'email_spec' RSpec.describe Emails::InProductMarketing do include EmailSpec::Matchers + include Gitlab::Routing.url_helpers let_it_be(:user) { create(:user) } - let_it_be(:group) { create(:group) } - - let!(:onboarding_progress) { create(:onboarding_progress, namespace: group) } - - describe '#in_product_marketing_email' do - using RSpec::Parameterized::TableSyntax - - let(:track) { :create } - let(:series) { 0 } - - subject { Notify.in_product_marketing_email(user.id, group.id, track, series) } - - include_context 'gitlab email notification' - - it 'sends to the right user with a link to unsubscribe' do - aggregate_failures do - expect(subject).to deliver_to(user.notification_email_or_default) - expect(subject).to have_body_text(profile_notifications_url) - end - end + shared_examples 'has custom headers when on gitlab.com' do context 'when on gitlab.com' do before do allow(Gitlab).to receive(:com?).and_return(true) @@ -45,6 +27,30 @@ RSpec.describe Emails::InProductMarketing do end end end + end + + describe '#in_product_marketing_email' do + let_it_be(:group) { create(:group) } + + let!(:onboarding_progress) { create(:onboarding_progress, namespace: group) } + + using RSpec::Parameterized::TableSyntax + + let(:track) { :create } + let(:series) { 0 } + + subject { Notify.in_product_marketing_email(user.id, group.id, track, series) } + + include_context 'gitlab email notification' + + it_behaves_like 'has custom headers when on gitlab.com' + + it 'sends to the right user with a link to unsubscribe' do + aggregate_failures do + expect(subject).to deliver_to(user.notification_email_or_default) + expect(subject).to have_body_text(profile_notifications_url) + end + end where(:track, :series) do :create | 0 @@ -68,7 +74,6 @@ RSpec.describe Emails::InProductMarketing do with_them do before do - stub_experiments(invite_members_for_task: :candidate) group.add_owner(user) end |