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-20 16:37:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 16:37:47 +0300
commitaee0a117a889461ce8ced6fcf73207fe017f1d99 (patch)
tree891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/mailers
parent8d46af3258650d305f53b819eabf7ab18d22f59e (diff)
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/emails/in_product_marketing_spec.rb47
-rw-r--r--spec/mailers/notify_spec.rb68
2 files changed, 50 insertions, 65 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
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index a5e3350ec2e..44cb18008d2 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -613,6 +613,28 @@ RSpec.describe Notify do
it 'has References header including the notes and issue of the discussion' do
expect(subject.header['References'].message_ids).to include("issue_#{note.noteable.id}@#{host}")
end
+
+ context 'with private references accessible to the recipient' do
+ let_it_be(:private_project) { create(:project, :private) }
+ let_it_be(:private_issue) { create(:issue, :closed, project: private_project) }
+
+ before_all do
+ private_project.add_guest(recipient)
+
+ note.update!(note: "#{private_issue.to_reference(full: true)}")
+ end
+
+ let(:html_part) { subject.body.parts.last.to_s }
+
+ it 'does not redact the reference' do
+ expect(html_part).to include("data-reference-type=\"issue\"")
+ expect(html_part).to include("title=\"#{private_issue.title}\"")
+ end
+
+ it 'renders expanded issue references' do
+ expect(html_part).to include("#{private_issue.to_reference(full: true)} (closed)")
+ end
+ end
end
end
@@ -807,7 +829,7 @@ RSpec.describe Notify do
end
it_behaves_like 'an email sent from GitLab'
- it_behaves_like 'it should not have Gmail Actions links'
+ it_behaves_like 'it should show Gmail Actions Join now link'
it_behaves_like "a user cannot unsubscribe through footer link"
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
@@ -845,48 +867,6 @@ RSpec.describe Notify do
end
end
- context 'with invite_email_preview_text enabled', :experiment do
- before do
- stub_experiments(invite_email_preview_text: :control)
- end
-
- it 'has the correct invite_url with params' do
- is_expected.to have_link('Join now',
- href: invite_url(project_member.invite_token,
- invite_type: Emails::Members::INITIAL_INVITE,
- experiment_name: 'invite_email_preview_text'))
- end
-
- it 'tracks the sent invite' do
- expect(experiment(:invite_email_preview_text)).to track(:assignment)
- .with_context(actor: project_member)
- .on_next_instance
-
- invite_email.deliver_now
- end
- end
-
- context 'with invite_email_from enabled', :experiment do
- before do
- stub_experiments(invite_email_from: :control)
- end
-
- it 'has the correct invite_url with params' do
- is_expected.to have_link('Join now',
- href: invite_url(project_member.invite_token,
- invite_type: Emails::Members::INITIAL_INVITE,
- experiment_name: 'invite_email_from'))
- end
-
- it 'tracks the sent invite' do
- expect(experiment(:invite_email_from)).to track(:assignment)
- .with_context(actor: project_member)
- .on_next_instance
-
- invite_email.deliver_now
- end
- end
-
context 'when invite email sent is tracked', :snowplow do
it 'tracks the sent invite' do
invite_email.deliver_now
@@ -1460,7 +1440,7 @@ RSpec.describe Notify do
subject { described_class.member_invited_email('Group', group_member.id, group_member.invite_token) }
it_behaves_like 'an email sent from GitLab'
- it_behaves_like 'it should not have Gmail Actions links'
+ it_behaves_like 'it should show Gmail Actions Join now link'
it_behaves_like "a user cannot unsubscribe through footer link"
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'