Make ActionMailer Synchronous In Test
Last updated
Was this helpful?
Last updated
Was this helpful?
When you set up an ActionMailer
email, the default configuration is for it to use ActiveJob
to send the emails. . Depending on your preferences for testing emails, you may prefer ActiveJob
to send the emails synchronously. This can be done by changing the queue_adapter
back to :inline
in your config/environments/test.rb
.
If you also configure the delivery_method
as :test
:
then emails will be queued up in ActionMailer::Base.deliveries
allowing you to write a test like this:
Check out for more on ActionMailer
.