Skip to content

Instantly share code, notes, and snippets.

@p0deje
Last active March 14, 2018 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p0deje/ffc833630ee70f2af5ff to your computer and use it in GitHub Desktop.
Save p0deje/ffc833630ee70f2af5ff to your computer and use it in GitHub Desktop.
Shared ActionMailer deliveries in :test mode to allow testing emails with Capybara/Selenium
# Share mail deliveries between threads.
# Just add it to features/support/env.rb or spec/spec_helper.rb
class Mail::TestMailer
mattr_accessor :shared_deliveries
def self.deliveries
@@shared_deliveries || []
end
end
Mail::TestMailer.shared_deliveries = Mail::TestMailer.deliveries
@mmontossi
Copy link

Any idea how to update the code to make it work with Rails 5.1?

@p0deje
Copy link
Author

p0deje commented Mar 14, 2018

I'm using it with Rails 5.1 and it works without any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment