diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-14 06:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-14 06:09:24 +0300 |
commit | d91ff791fb4a0b595b2b3f1adc6e9dd55899e320 (patch) | |
tree | 05091e2680aa474474ca853171588e12551aca6c /spec/mailers | |
parent | b941629bbf312ed71c6065e2c3a6ef5a35dfa19c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/devise_mailer_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/mailers/devise_mailer_spec.rb b/spec/mailers/devise_mailer_spec.rb new file mode 100644 index 00000000000..3a82b118ada --- /dev/null +++ b/spec/mailers/devise_mailer_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'email_spec' + +RSpec.describe DeviseMailer do + describe "#confirmation_instructions" do + subject { described_class.confirmation_instructions(user, 'faketoken', {}) } + + context "when confirming the unconfirmed_email" do + let(:user) { build(:user, unconfirmed_email: 'jdoe@example.com') } + + it "shows the unconfirmed_email" do + expect(subject.body.encoded).to have_text user.unconfirmed_email + expect(subject.body.encoded).not_to have_text user.email + end + end + + context "when re-confirming the primary email after a security issue" do + let(:user) { build(:user, created_at: 10.days.ago, unconfirmed_email: nil) } + + it "shows the primary email" do + expect(subject.body.encoded).to have_text user.email + end + end + end +end |