Fix bug send email sign up user
This commit is contained in:
parent
2d6e0d2864
commit
02b7680083
2 changed files with 24 additions and 9 deletions
|
@ -2,6 +2,11 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||
# before_filter :configure_sign_up_params, only: [:create]
|
||||
# before_filter :configure_account_update_params, only: [:update]
|
||||
|
||||
def after_sign_up_path_for(resource_or_scope)
|
||||
WelcomeMailer.welcome_email(User.last).deliver_now!
|
||||
super
|
||||
end
|
||||
|
||||
# GET /resource/sign_up
|
||||
# def new
|
||||
# super
|
||||
|
@ -9,9 +14,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||
|
||||
# POST /resource
|
||||
def create
|
||||
retour = super
|
||||
WelcomeMailer.welcome_email(User.last).deliver_now!
|
||||
retour
|
||||
super
|
||||
end
|
||||
|
||||
# GET /resource/edit
|
||||
|
|
|
@ -14,6 +14,7 @@ describe Users::RegistrationsController, type: :controller do
|
|||
describe '.create' do
|
||||
subject { post :create, user: user }
|
||||
|
||||
context 'when user is correct' do
|
||||
it { expect(described_class).to be < Devise::RegistrationsController }
|
||||
|
||||
it 'welcome email is send' do
|
||||
|
@ -23,4 +24,15 @@ describe Users::RegistrationsController, type: :controller do
|
|||
subject
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is not correct' do
|
||||
let(:user) { {email: '', password: password, password_confirmation: password} }
|
||||
|
||||
it 'welcome email is not send' do
|
||||
expect(WelcomeMailer).not_to receive(:welcome_email)
|
||||
|
||||
subject
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue