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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-07 12:09:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-07 12:09:59 +0300
commitdc62bfce8b1c716decb59a8d3fae4985d5490025 (patch)
tree56ff6438f9592ecf75ad90568ae50003b0b49678 /spec/mailers
parenta608e1204587c25a55d69fd8ac624f42e45c831e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/emails/in_product_marketing_spec.rb77
1 files changed, 57 insertions, 20 deletions
diff --git a/spec/mailers/emails/in_product_marketing_spec.rb b/spec/mailers/emails/in_product_marketing_spec.rb
index a811b345c62..f6f8c187e80 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
@@ -102,4 +108,35 @@ RSpec.describe Emails::InProductMarketing do
end
end
end
+
+ describe '#account_validation_email' do
+ let_it_be(:namespace) { create(:namespace) }
+ let_it_be(:project) { create(:project, :repository, namespace: namespace) }
+ let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
+
+ subject { Notify.account_validation_email(pipeline, user.notification_email_or_default) }
+
+ it 'sends to the right user with a link to unsubscribe' do
+ expect(subject).to deliver_to(user.notification_email_or_default)
+ end
+
+ it_behaves_like 'has custom headers when on gitlab.com'
+
+ it 'has the correct subject and content' do
+ message = Gitlab::Email::Message::AccountValidation.new(pipeline)
+ cta_url = project_pipeline_url(pipeline.project, pipeline)
+ cta2_url = 'https://docs.gitlab.com/runner/install/'
+
+ aggregate_failures do
+ is_expected.to have_subject(message.subject_line)
+ is_expected.to have_body_text(message.title)
+ is_expected.to have_body_text(message.body_line1)
+ is_expected.to have_body_text(CGI.unescapeHTML(message.body_line2))
+ is_expected.to have_body_text(CGI.unescapeHTML(message.cta_link))
+ is_expected.to have_body_text(CGI.unescapeHTML(message.cta2_link))
+ is_expected.to have_body_text(cta_url)
+ is_expected.to have_body_text(cta2_url)
+ end
+ end
+ end
end