diff options
author | Yves Senn <yves.senn@gmail.com> | 2016-02-08 11:47:25 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2016-02-16 11:20:59 +0100 |
commit | 9d378747326d26cf1afdac4433ead22967af0984 (patch) | |
tree | bd377111a1ce085f8e31198fa636f6f9b8235254 /guides | |
parent | 3dd9fe5db44777eaf3765875fe259d53e72a0448 (diff) | |
download | rails-9d378747326d26cf1afdac4433ead22967af0984.tar.gz rails-9d378747326d26cf1afdac4433ead22967af0984.tar.bz2 rails-9d378747326d26cf1afdac4433ead22967af0984.zip |
reset `ActionMailer::Base.deliveries` in `ActionDispatch::IntegrationTest`.
Whenever you are sending emails in integration tests using the `:test`
delivery method you need to make sure that
`ActionMailer::Base.deliveries` is reset after every test. This piece of
boilerplate code is present in all my applications that send
emails. Let's have `ActionDispatch::IntegrationTest` reset the
deliveries automatically.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/testing.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md index 13f4446751..7a9a30f7ac 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -1191,9 +1191,9 @@ testing) but instead it will be appended to an array (`ActionMailer::Base.deliveries`). NOTE: The `ActionMailer::Base.deliveries` array is only reset automatically in -`ActionMailer::TestCase` tests. If you want to have a clean slate outside Action -Mailer tests, you can reset it manually with: -`ActionMailer::Base.deliveries.clear` +`ActionMailer::TestCase` and `ActionDispatch::IntegrationTest` tests. +If you want to have a clean slate outside these test cases, you can reset it +manually with: `ActionMailer::Base.deliveries.clear` ### Functional Testing |