diff options
author | Kir Shatrov <shatrov@me.com> | 2015-01-03 23:25:09 +0100 |
---|---|---|
committer | Kir Shatrov <shatrov@me.com> | 2015-01-03 23:25:09 +0100 |
commit | cf87cfeb5730ab9982adcb0a6b5608c7e75b3fa0 (patch) | |
tree | e7b625e2fc07a9b2907c6ac932a0be50884a71e6 /guides/source | |
parent | 4a3b9c82830b08056467524081d4dd408eb6db43 (diff) | |
download | rails-cf87cfeb5730ab9982adcb0a6b5608c7e75b3fa0.tar.gz rails-cf87cfeb5730ab9982adcb0a6b5608c7e75b3fa0.tar.bz2 rails-cf87cfeb5730ab9982adcb0a6b5608c7e75b3fa0.zip |
Demonstrate example of `assert_emails` in testing guide
rails/rails#18305, thanks for @dhh suggestion
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/testing.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md index d6e4aa36db..065ca71d48 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -1098,9 +1098,10 @@ require 'test_helper' class UserMailerTest < ActionMailer::TestCase test "invite" do # Send the email, then test that it got queued - email = UserMailer.create_invite('me@example.com', - 'friend@example.com', Time.now).deliver_now - assert ActionMailer::Base.deliveries.present? + assert_emails 1 do + email = UserMailer.create_invite('me@example.com', + 'friend@example.com', Time.now).deliver_now + end # Test the body of the sent email contains what we expect it to assert_equal ['me@example.com'], email.from |