assert_emails(number)
Instance Public methods
Asserts that the number of emails sent matches the given number.
1 2 3 4 5 6 7 | def test_emails assert_emails 0 ContactMailer.welcome.deliver assert_emails 1 ContactMailer.welcome.deliver assert_emails 2 end |
If a block is passed, that block should cause the specified number of emails to be sent.
1 2 3 4 5 6 7 8 9 10 | def test_emails_again assert_emails 1 do ContactMailer.welcome.deliver end assert_emails 2 do ContactMailer.welcome.deliver ContactMailer.welcome.deliver end end |
Please login to continue.