No commit activity in last 3 years
No release in over 3 years
require 'mail' require 'mail-store-agent' Mail.defaults do delivery_method :test end Mail::TestMailer.deliveries = MailStoreAgent.new # send some mail to someone@someplace.com, and then ... Mail::TestMailer.deliveries.get('someone@someplace.com').is_a? Mail::Message # or nil
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 0
 Project Readme

MailStoreAgent

Background

Most websites that authenticate users require some form of user account self-management. Users need to register with e-mail and password, verify their e-mail address, and to occasionally reset their e-mail and password.

I like to delegate this to other services with OpenID and OAuth, but not all clients agree to delegate ownership of their customers' authentication records.

So I'm often stuck with implementing these boilerplace features yet again, each of the above use-cases require sending out e-mails to confirm or facilitate. Testing this can be a pain-in-the-butt.

Fortunately, Mikel Lindsaar's Mail gem has a simple and effective way to store and not send e-mails in order to facilitate test scripts.

Mail::TestMailer

Mail.defaults do
  delivery_method :test
end

# send a few mails ...

Mail::TestMailer.deliveries.is_a? Array # ==> true
Mail::TestMailer.deliveries.first.is_a? Mail::Message # ==> true

I want to take this a step further so that I can verify that mail got sent to the right people in the right order:

SYNOPSIS

require 'mail'
require 'mail-store-agent'

Mail.defaults do
  delivery_method :test
end

Mail::TestMailer.deliveries = MailStoreAgent.new

# send some mail to someone@someplace.com, and then ...

Mail::TestMailer.deliveries.get('someone@someplace.com').is_a? Mail::Message # or nil

LICENSE