class Mail::TestMailer

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

Attributes

settings[RW]

Public Class Methods

deliveries() click to toggle source

Provides a store of all the emails sent with the TestMailer so you can check them.

# File lib/mail/network/delivery_methods/test_mailer.rb, line 13
def TestMailer.deliveries
  @@deliveries ||= []
end
deliveries=(val) click to toggle source

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 ::deliveries.clear.

If you place another object here, please make sure it responds to:

  • << (message)

  • clear

  • length

  • size

  • and other common Array methods

# File lib/mail/network/delivery_methods/test_mailer.rb, line 28
def TestMailer.deliveries=(val)
  @@deliveries = val
end
new(values) click to toggle source
# File lib/mail/network/delivery_methods/test_mailer.rb, line 32
def initialize(values)
  @settings = values.dup
end

Public Instance Methods

deliver!(mail) click to toggle source
# File lib/mail/network/delivery_methods/test_mailer.rb, line 38
def deliver!(mail)
  check_delivery_params(mail)
  Mail::TestMailer.deliveries << mail
end