method
assert_emails
v3.2.13 -
Show latest stable
-
1 note -
Class: ActionMailer::TestHelper
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (-38)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (19)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (2)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- 7.2.3 (0)
- 8.0.0 (0)
- 8.1.1 (0)
- What's this?
assert_emails(number)
public
Asserts that the number of emails sent matches the given number.
def test_emails assert_emails 0 ContactMailer.deliver_contact assert_emails 1 ContactMailer.deliver_contact assert_emails 2 end
If a block is passed, that block should cause the specified number of emails to be sent.
def test_emails_again assert_emails 1 do ContactMailer.deliver_contact end assert_emails 2 do ContactMailer.deliver_contact ContactMailer.deliver_contact end end
Register or
log in
to add new notes.
thewinner -
May 6, 2011
0 thanks
Asserting Emails
–setup_mailer.rb in config/initializers –rails g mailer MailerName –methods in mailer_name.rb –files in views/mailer_name –MailerName.method(@object).deliver in object controller

