File tree 2 files changed +12
-2
lines changed
test/mailers/passwordless
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 3
3
module Passwordless
4
4
# The mailer responsible for sending Passwordless' mails.
5
5
class Mailer < Passwordless . config . parent_mailer . constantize
6
- default from : Passwordless . config . default_from_address
6
+ default ( from : Passwordless . config . default_from_address ) if Passwordless . config . default_from_address
7
7
8
8
# Sends a token and a magic link
9
9
#
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class Passwordless::MailerTest < ActionMailer::TestCase
49
49
# parent class for the mailer. This means `Passwordless::Mailer` needs
50
50
# to be reloaded, otherwise it will still have the old parent class.
51
51
reload_mailer!
52
-
52
+
53
53
session = Passwordless ::Session . create! ( authenticatable : users ( :alice ) , token : "hello" )
54
54
email = Passwordless ::Mailer . sign_in ( session , "hello" )
55
55
@@ -60,4 +60,14 @@ class Passwordless::MailerTest < ActionMailer::TestCase
60
60
# after the `with_config` block.
61
61
reload_mailer!
62
62
end
63
+
64
+ test ( "uses default from address of parent when default_from_address is nil" ) do
65
+ with_config ( { parent_mailer : "ApplicationMailer" , default_from_address : nil } ) do
66
+ reload_mailer!
67
+
68
+ assert_equal ApplicationMailer . default . fetch ( :from ) , Passwordless ::Mailer . default . fetch ( :from )
69
+ end
70
+ ensure
71
+ reload_mailer!
72
+ end
63
73
end
You can’t perform that action at this time.
0 commit comments