21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-05 02:05:09 +02:00

Devise send email notifiation async

This commit is contained in:
Colin Darie 2018-06-05 20:18:41 +02:00
parent 8ff94076c0
commit a0cec2aa96
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 10 additions and 1 deletions

View file

@ -39,4 +39,9 @@ class User < ApplicationRecord
validates :tos_accepted, acceptance: true
scope :notifications_disabled, -> { where(notifications_enabled: false) }
# Devise ActiveJob integration
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
end

View file

@ -17,7 +17,11 @@ class UsersTest < ApplicationSystemTestCase
fill_in("user[password_confirmation]", with: password)
check "user[tos_accepted]"
click_button I18n.t("devise.registrations.new.sign_up")
# confirmation email is sent in async
perform_enqueued_jobs do
click_button I18n.t("devise.registrations.new.sign_up")
end
assert_performed_jobs 1
assert_equal root_path, page.current_path
user = User.find_by!(email: email, confirmed_at: nil)