diff options
author | Brett Walker <brett@digitalmoksha.com> | 2017-09-04 19:23:33 +0200 |
---|---|---|
committer | Brett Walker <brett@digitalmoksha.com> | 2017-09-23 15:23:11 +0200 |
commit | f9f467227538df0ce2012df39dfdcf55fb260f94 (patch) | |
tree | 7ebabd8226e6db955d77ca456406197b6a8c0e6b /spec/controllers/profiles | |
parent | b14641579855a14398db260ab909ae77c164c883 (diff) | |
download | gitlab-ce-f9f467227538df0ce2012df39dfdcf55fb260f94.tar.gz |
Send a confirmation email when the user adds a secondary email address. Utilizes the Devise `confirmable` capabilities. Issue #37385
Diffstat (limited to 'spec/controllers/profiles')
-rw-r--r-- | spec/controllers/profiles/emails_controller_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/controllers/profiles/emails_controller_spec.rb b/spec/controllers/profiles/emails_controller_spec.rb new file mode 100644 index 00000000000..00862f12b7e --- /dev/null +++ b/spec/controllers/profiles/emails_controller_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe Profiles::EmailsController do + + let(:user) { create(:user) } + + before do + sign_in(user) + end + + describe '#create' do + let(:email_params) { {email: "add_email@example.com" } } + + it 'sends an email confirmation' do + expect {post(:create, { email: email_params })}.to change { ActionMailer::Base.deliveries.size } + expect(ActionMailer::Base.deliveries.last.to).to eq [email_params[:email]] + expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions" + end + end +end |