diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/mailers | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/identity_verification_spec.rb | 42 | ||||
-rw-r--r-- | spec/mailers/emails/releases_spec.rb | 1 | ||||
-rw-r--r-- | spec/mailers/notify_spec.rb | 2 |
3 files changed, 44 insertions, 1 deletions
diff --git a/spec/mailers/emails/identity_verification_spec.rb b/spec/mailers/emails/identity_verification_spec.rb new file mode 100644 index 00000000000..57ae95cc1ee --- /dev/null +++ b/spec/mailers/emails/identity_verification_spec.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Emails::IdentityVerification do + include EmailSpec::Matchers + include_context 'gitlab email notification' + + describe 'verification_instructions_email' do + let_it_be(:user) { build_stubbed(:user) } + let_it_be(:token) { '123456' } + + subject do + Notify.verification_instructions_email(user.email, token: token) + end + + it_behaves_like 'an email sent from GitLab' + + it 'is sent to the user' do + is_expected.to deliver_to user.email + end + + it 'has the correct subject' do + is_expected.to have_subject s_('IdentityVerification|Verify your identity') + end + + it 'has the mailgun suppression bypass header' do + is_expected.to have_header 'X-Mailgun-Suppressions-Bypass', 'true' + end + + it 'includes the token' do + is_expected.to have_body_text token + end + + it 'includes the expiration time' do + expires_in_minutes = Users::EmailVerification::ValidateTokenService::TOKEN_VALID_FOR_MINUTES + + is_expected.to have_body_text format(s_('IdentityVerification|Your verification code expires after '\ + '%{expires_in_minutes} minutes.'), expires_in_minutes: expires_in_minutes) + end + end +end diff --git a/spec/mailers/emails/releases_spec.rb b/spec/mailers/emails/releases_spec.rb index d1d7f5e6d6a..e8ca9533256 100644 --- a/spec/mailers/emails/releases_spec.rb +++ b/spec/mailers/emails/releases_spec.rb @@ -16,6 +16,7 @@ RSpec.describe Emails::Releases do subject { Notify.new_release_email(user.id, release) } it_behaves_like 'an email sent from GitLab' + it_behaves_like 'an email with X-GitLab headers containing project details' context 'when the release has a name' do it 'shows the correct subject' do diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 1f53c472c5c..5733e892d2a 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -750,7 +750,7 @@ RSpec.describe Notify do before_all do private_project.add_guest(recipient) - note.update!(note: "#{private_issue.to_reference(full: true)}") + note.update!(note: private_issue.to_reference(full: true).to_s) end let(:html_part) { subject.body.parts.last.to_s } |