diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-03 12:11:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-03 12:11:20 +0000 |
commit | 720cf698151643831bf36e3bd4ccd1c8e9246184 (patch) | |
tree | 091708527a68cca3d015d859700e0a67518a3b1d /spec/mailers | |
parent | 058bd6be52a5e68ea81f9026201b1136610336b1 (diff) | |
download | gitlab-ce-720cf698151643831bf36e3bd4ccd1c8e9246184.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/identity_verification_spec.rb | 42 |
1 files changed, 42 insertions, 0 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 |