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
|
@ -1,3 +1,8 @@
|
||||||
|
== master
|
||||||
|
|
||||||
|
* bug fix
|
||||||
|
* Fix inheriting mailer templates from `Devise::Mailer`
|
||||||
|
|
||||||
== 2.2.3
|
== 2.2.3
|
||||||
|
|
||||||
* bug fix
|
* bug fix
|
||||||
|
|
|
@ -64,7 +64,7 @@ module Devise
|
||||||
end
|
end
|
||||||
|
|
||||||
def template_paths
|
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.unshift "#{@devise_mapping.scoped_path}/mailer" if self.class.scoped_views?
|
||||||
template_path
|
template_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,6 +46,11 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['custom@example.com'], mail.from
|
assert_equal ['custom@example.com'], mail.from
|
||||||
end
|
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
|
test 'setup reply to as copy from sender' do
|
||||||
assert_equal ['test@example.com'], mail.reply_to
|
assert_equal ['test@example.com'], mail.reply_to
|
||||||
end
|
end
|
||||||
|
@ -56,7 +61,6 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['custom_reply_to@example.com'], mail.reply_to
|
assert_equal ['custom_reply_to@example.com'], mail.reply_to
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
test 'setup subject from I18n' do
|
test 'setup subject from I18n' do
|
||||||
store_translations :en, :devise => { :mailer => { :confirmation_instructions => { :subject => 'Account Confirmation' } } } do
|
store_translations :en, :devise => { :mailer => { :confirmation_instructions => { :subject => 'Account Confirmation' } } } do
|
||||||
assert_equal 'Account Confirmation', mail.subject
|
assert_equal 'Account Confirmation', mail.subject
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
setup_mailer
|
setup_mailer
|
||||||
Devise.mailer = 'Devise::Mailer'
|
Devise.mailer = 'Devise::Mailer'
|
||||||
|
@ -49,6 +48,11 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['custom@example.com'], mail.from
|
assert_equal ['custom@example.com'], mail.from
|
||||||
end
|
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
|
test 'setup reply to as copy from sender' do
|
||||||
assert_equal ['test@example.com'], mail.reply_to
|
assert_equal ['test@example.com'], mail.reply_to
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,6 +49,11 @@ class UnlockInstructionsTest < ActionMailer::TestCase
|
||||||
assert_equal ['custom@example.com'], mail.from
|
assert_equal ['custom@example.com'], mail.from
|
||||||
end
|
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
|
test 'setup reply to as copy from sender' do
|
||||||
assert_equal ['test@example.com'], mail.reply_to
|
assert_equal ['test@example.com'], mail.reply_to
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue