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