Commit 7574b53c authored by Thong Kuah's avatar Thong Kuah

Merge branch 'move-account-validation-email-under-ee' into 'master'

Move account validation email under EE

See merge request gitlab-org/gitlab!76425
parents 9d65b3fa 25297399
...@@ -21,12 +21,6 @@ module Emails ...@@ -21,12 +21,6 @@ module Emails
mail_to(to: email, subject: @message.subject_line) mail_to(to: email, subject: @message.subject_line)
end end
def account_validation_email(pipeline, recipient_email)
@message = Gitlab::Email::Message::AccountValidation.new(pipeline)
mail_to(to: recipient_email, subject: @message.subject_line)
end
private private
def mail_to(to:, subject:) def mail_to(to:, subject:)
...@@ -47,3 +41,5 @@ module Emails ...@@ -47,3 +41,5 @@ module Emails
end end
end end
end end
Emails::InProductMarketing.prepend_mod
# frozen_string_literal: true
module EE
module Emails
module InProductMarketing
def account_validation_email(pipeline, recipient_email)
@message = ::Gitlab::Email::Message::AccountValidation.new(pipeline)
mail_to(to: recipient_email, subject: @message.subject_line)
end
end
end
end
...@@ -14,6 +14,7 @@ module EE ...@@ -14,6 +14,7 @@ module EE
include ::Emails::UserCap include ::Emails::UserCap
include ::Emails::OncallRotation include ::Emails::OncallRotation
include ::Emails::GroupMemberships include ::Emails::GroupMemberships
include ::Emails::InProductMarketing
end end
attr_reader :group attr_reader :group
......
# frozen_string_literal: true
require 'spec_helper'
require 'email_spec'
RSpec.describe Emails::InProductMarketing do
include EmailSpec::Matchers
include Gitlab::Routing.url_helpers
let_it_be(:user) { create(:user) }
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 '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
...@@ -108,35 +108,4 @@ RSpec.describe Emails::InProductMarketing do ...@@ -108,35 +108,4 @@ RSpec.describe Emails::InProductMarketing do
end end
end 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment