From f06132edf1a401d98be1d05816ea21681f9189bb Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 7 Jun 2018 15:05:30 +0200 Subject: [PATCH 1/2] Forgot to change a local variable into an instance variable --- app/mailers/user_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index c0b8a7547..f4cdab83d 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -5,6 +5,6 @@ class UserMailer < ApplicationMailer @user = user @subject = "Demande de création de compte" - mail(to: user.email, subject: subject) + mail(to: user.email, subject: @subject) end end From b88cea3c18f2c78f22dc77077a1f6fb2d228108f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 7 Jun 2018 15:07:14 +0200 Subject: [PATCH 2/2] Change a deliver into a deliver_later --- app/controllers/users/registrations_controller.rb | 2 +- spec/controllers/users/registrations_controller_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index b1787becf..95be35e5b 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -17,7 +17,7 @@ class Users::RegistrationsController < Devise::RegistrationsController def create user = User.find_by(email: params[:user][:email]) if user.present? - UserMailer.new_account_warning(user).deliver + UserMailer.new_account_warning(user).deliver_later flash.notice = t('devise.registrations.signed_up_but_unconfirmed') redirect_to root_path else diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb index 8fe725f9f..baebdd389 100644 --- a/spec/controllers/users/registrations_controller_spec.rb +++ b/spec/controllers/users/registrations_controller_spec.rb @@ -37,7 +37,7 @@ describe Users::RegistrationsController, type: :controller do let!(:existing_user) { create(:user, email: email, password: password) } before do - allow(UserMailer).to receive(:new_account_warning).and_return(double(deliver: 'deliver')) + allow(UserMailer).to receive(:new_account_warning).and_return(double(deliver_later: 'deliver')) subject end