From 18dceeb425a92254f534202ec6ced700cfdd1567 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sat, 26 Jan 2013 17:04:06 +0100 Subject: document the behavior of `ActionMailer::Base.delivieries` in tests thanks @danielpuglisi --- guides/source/action_mailer_basics.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guides') diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index 7f992025e4..4871944d2c 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -576,6 +576,8 @@ end In the test we send the email and store the returned object in the `email` variable. We then ensure that it was sent (the first assert), then, in the second batch of assertions, we ensure that the email does indeed contain what we expect. +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` + Intercepting Emails ------------------- There are situations where you need to edit an email before it's delivered. Fortunately Action Mailer provides hooks to intercept every email. You can register an interceptor to make modifications to mail messages right before they are handed to the delivery agents. -- cgit v1.2.3