Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Cache delivery method for ActionMailer

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 action_mailer_cache_delivery.gemspec
README.md

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).

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.

Something went wrong with that request. Please try again.