Low commit activity in last 3 years
A long-lived project that still receives updates
Cache delivery method for ActionMailer for testing emails with Selenium
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9
~> 2.8

Runtime

 Project Readme

Action Mailer Cache Delivery Build Status Gem Version

Enhances ActionMailer to support the :cache delivery method, which behaves like :test, except that the deliveries are marshalled to a temporary cache file, thus making them available to other processes.

You'll want to use this gem if you're testing with Selenium (or any other tool which distinct processes). Another approach would be to share deliveries between threads (in this case, this gem is not needed at all).

Installation

Add to Gemfile

gem 'action_mailer_cache_delivery'

Now run bundle install

Usage

Change delivery method in your config/environments/test.rb

config.action_mailer.delivery_method = :cache

You can optionally specify location for cache file.

config.action_mailer.cache_settings = { :location => "#{Rails.root}/tmp/mail.cache" }

To access the cached deliveries in another process, just do

ActionMailer::Base.cached_deliveries

Use with parallel_tests

If you use parallel_tests to run your tests in parallel, you may get unexpected errors like EOFError. If so, make sure cache files differ for processes. Change you config/environment/test.rb

config.action_mailer.cache_settings = { :location => "#{Rails.root}/tmp/cache/action_mailer_cache_delivery#{ENV['TEST_ENV_NUMBER']}.cache" }

Contributors

I tried to list there everyone who forked original version on GitHub. If you're not here, just send pull request.