diff options
Diffstat (limited to 'spec/mailers/devise_mailer_spec.rb')
-rw-r--r-- | spec/mailers/devise_mailer_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/mailers/devise_mailer_spec.rb b/spec/mailers/devise_mailer_spec.rb index 4637df9c8a3..2ee15308400 100644 --- a/spec/mailers/devise_mailer_spec.rb +++ b/spec/mailers/devise_mailer_spec.rb @@ -4,6 +4,9 @@ require 'spec_helper' require 'email_spec' RSpec.describe DeviseMailer do + include EmailSpec::Matchers + include_context 'gitlab email notification' + describe "#confirmation_instructions" do subject { described_class.confirmation_instructions(user, 'faketoken', {}) } @@ -35,4 +38,30 @@ RSpec.describe DeviseMailer do end end end + + describe '#password_change_by_admin' do + subject { described_class.password_change_by_admin(user) } + + let_it_be(:user) { create(:user) } + + it_behaves_like 'an email sent from GitLab' + it_behaves_like 'it should not have Gmail Actions links' + it_behaves_like 'a user cannot unsubscribe through footer link' + + 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 /^Password changed by administrator$/i + end + + it 'includes the correct content' do + is_expected.to have_body_text /An administrator changed the password for your GitLab account/ + end + + it 'includes a link to GitLab' do + is_expected.to have_body_text /#{Gitlab.config.gitlab.url}/ + end + end end |