Class: Mail::TestMailer
- Inherits:
-
Object
- Object
- Mail::TestMailer
- Defined in:
- lib/mail/network/delivery_methods/test_mailer.rb
Overview
The TestMailer is a bare bones mailer that does nothing. It is useful when you are testing.
It also provides a template of the minimum methods you require to implement if you want to make a custom mailer for Mail
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Class Method Summary collapse
-
.deliveries ⇒ Object
Provides a store of all the emails sent with the TestMailer so you can check them.
-
.deliveries=(val) ⇒ Object
Allows you to over write the default deliveries store from an array to some other object.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(values) ⇒ TestMailer
constructor
A new instance of TestMailer.
Constructor Details
#initialize(values) ⇒ TestMailer
Returns a new instance of TestMailer.
29 30 31 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 29 def initialize(values) @settings = {} end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
33 34 35 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 33 def settings @settings end |
Class Method Details
.deliveries ⇒ Object
Provides a store of all the emails sent with the TestMailer so you can check them.
10 11 12 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 10 def TestMailer.deliveries @@deliveries ||= [] end |
.deliveries=(val) ⇒ Object
Allows you to over write the default deliveries store from an array to some other object. If you just want to clear the store, call TestMailer.deliveries.clear.
If you place another object here, please make sure it responds to:
-
<< (message)
-
clear
-
length
-
size
-
and other common Array methods
25 26 27 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 25 def TestMailer.deliveries=(val) @@deliveries = val end |
Instance Method Details
#deliver!(mail) ⇒ Object
35 36 37 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 35 def deliver!(mail) Mail::TestMailer.deliveries << mail end |