mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Fix inheriting mailer templates from Devise::Mailer
Previously inheriting from Devise::Mailer would not render default views from devise when the inheriting mailer didn't have the view. Now it'll correctly pick the default one from Devise::Mailer.
This commit is contained in:
parent
72be1f1289
commit
83ad67bd51
5 changed files with 21 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
== master
|
||||
|
||||
* bug fix
|
||||
* Fix inheriting mailer templates from `Devise::Mailer`
|
||||
|
||||
== 2.2.3
|
||||
|
||||
* bug fix
|
||||
|
|
|
@ -64,7 +64,7 @@ module Devise
|
|||
end
|
||||
|
||||
def template_paths
|
||||
template_path = [self.class.mailer_name]
|
||||
template_path = _prefixes.dup
|
||||
template_path.unshift "#{@devise_mapping.scoped_path}/mailer" if self.class.scoped_views?
|
||||
template_path
|
||||
end
|
||||
|
|
|
@ -46,6 +46,11 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'custom mailer renders parent mailer template' do
|
||||
Devise.mailer = 'Users::Mailer'
|
||||
assert_not_blank mail.body.encoded
|
||||
end
|
||||
|
||||
test 'setup reply to as copy from sender' do
|
||||
assert_equal ['test@example.com'], mail.reply_to
|
||||
end
|
||||
|
@ -56,7 +61,6 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom_reply_to@example.com'], mail.reply_to
|
||||
end
|
||||
|
||||
|
||||
test 'setup subject from I18n' do
|
||||
store_translations :en, :devise => { :mailer => { :confirmation_instructions => { :subject => 'Account Confirmation' } } } do
|
||||
assert_equal 'Account Confirmation', mail.subject
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
||||
|
||||
def setup
|
||||
setup_mailer
|
||||
Devise.mailer = 'Devise::Mailer'
|
||||
|
@ -49,6 +48,11 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'custom mailer renders parent mailer template' do
|
||||
Devise.mailer = 'Users::Mailer'
|
||||
assert_not_blank mail.body.encoded
|
||||
end
|
||||
|
||||
test 'setup reply to as copy from sender' do
|
||||
assert_equal ['test@example.com'], mail.reply_to
|
||||
end
|
||||
|
|
|
@ -49,6 +49,11 @@ class UnlockInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'custom mailer renders parent mailer template' do
|
||||
Devise.mailer = 'Users::Mailer'
|
||||
assert_not_blank mail.body.encoded
|
||||
end
|
||||
|
||||
test 'setup reply to as copy from sender' do
|
||||
assert_equal ['test@example.com'], mail.reply_to
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue