Class: Mail::TestMailer
- Includes:
- CheckDeliveryParams
- 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.
Methods included from CheckDeliveryParams
Constructor Details
#initialize(values) ⇒ TestMailer
Returns a new instance of TestMailer.
32 33 34 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 32 def initialize(values) @settings = {} end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
36 37 38 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 36 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.
13 14 15 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 13 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
28 29 30 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 28 def TestMailer.deliveries=(val) @@deliveries = val end |
Instance Method Details
#deliver!(mail) ⇒ Object
38 39 40 41 |
# File 'lib/mail/network/delivery_methods/test_mailer.rb', line 38 def deliver!(mail) check_params(mail) Mail::TestMailer.deliveries << mail end |