[Fix #1972] Make devise mails async
This commit is contained in:
parent
07b1c147d9
commit
fd168c4a72
7 changed files with 12 additions and 6 deletions
1
Gemfile
1
Gemfile
|
@ -42,6 +42,7 @@ gem 'unicode_utils'
|
|||
|
||||
# Gestion des comptes utilisateurs
|
||||
gem 'devise'
|
||||
gem 'devise-async'
|
||||
gem 'openid_connect'
|
||||
gem 'omniauth-github'
|
||||
|
||||
|
|
|
@ -175,6 +175,9 @@ GEM
|
|||
railties (>= 4.1.0, < 6.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
devise-async (1.0.0)
|
||||
activejob (>= 5.0)
|
||||
devise (>= 4.0)
|
||||
diff-lcs (1.3)
|
||||
domain_name (0.5.20170404)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
|
@ -803,6 +806,7 @@ DEPENDENCIES
|
|||
delayed_job_active_record
|
||||
delayed_job_web!
|
||||
devise
|
||||
devise-async
|
||||
dotenv-rails
|
||||
draper
|
||||
factory_bot
|
||||
|
|
|
@ -2,7 +2,7 @@ class Administrateur < ApplicationRecord
|
|||
include CredentialsSyncableConcern
|
||||
include EmailSanitizableConcern
|
||||
|
||||
devise :database_authenticatable, :registerable,
|
||||
devise :database_authenticatable, :registerable, :async,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
has_and_belongs_to_many :gestionnaires
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Administration < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: [:github]
|
||||
devise :database_authenticatable, :rememberable, :trackable, :validatable, :omniauthable, :async, omniauth_providers: [:github]
|
||||
|
||||
def self.from_omniauth(params)
|
||||
find_by(email: params["info"]["email"])
|
||||
|
|
|
@ -2,7 +2,7 @@ class Gestionnaire < ApplicationRecord
|
|||
include CredentialsSyncableConcern
|
||||
include EmailSanitizableConcern
|
||||
|
||||
devise :database_authenticatable, :registerable,
|
||||
devise :database_authenticatable, :registerable, :async,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
has_and_belongs_to_many :administrateurs
|
||||
|
|
|
@ -9,7 +9,7 @@ class User < ApplicationRecord
|
|||
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
devise :database_authenticatable, :registerable, :async,
|
||||
:recoverable, :rememberable, :trackable, :validatable, :confirmable
|
||||
|
||||
has_many :dossiers, dependent: :destroy
|
||||
|
|
|
@ -15,8 +15,9 @@ describe Users::RegistrationsController, type: :controller do
|
|||
|
||||
context 'when user is correct' do
|
||||
it 'sends confirmation instruction' do
|
||||
expect(DeviseUserMailer).to receive(:confirmation_instructions).and_return(DeviseUserMailer)
|
||||
expect(DeviseUserMailer).to receive(:deliver)
|
||||
message = double()
|
||||
expect(DeviseUserMailer).to receive(:confirmation_instructions).and_return(message)
|
||||
expect(message).to receive(:deliver_later)
|
||||
|
||||
subject
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue