diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-09-28 12:11:48 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-09-28 12:13:07 +0100 |
commit | 7e0cf563639bc7508da381b1b8321c7a89be1aa8 (patch) | |
tree | 8523ada77bfb8630cdc88520b6ae65b78a1afb11 /actionmailer/test/base_test.rb | |
parent | aa8918aecbc49f36faec4fa5d3d0efd7a4c9e889 (diff) | |
download | rails-7e0cf563639bc7508da381b1b8321c7a89be1aa8.tar.gz rails-7e0cf563639bc7508da381b1b8321c7a89be1aa8.tar.bz2 rails-7e0cf563639bc7508da381b1b8321c7a89be1aa8.zip |
Support `Mailer.deliver_foo(*args)` as a synonym for `Mailer.foo(*args).deliver`.
This makes it easy to write e.g. `Mailer.expects(:deliver_foo)` when
testing code that calls the mailer.
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r-- | actionmailer/test/base_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 4f2af50fdd..17ce8b7072 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -662,6 +662,13 @@ class BaseTest < ActiveSupport::TestCase assert_equal ["robert.pankowecki@gmail.com"], DefaultFromMailer.welcome.from end + test "Mailer.deliver_welcome calls Mailer.welcome.deliver" do + BaseMailer.deliveries.clear + BaseMailer.deliver_welcome(subject: 'omg') + assert_equal 1, BaseMailer.deliveries.length + assert_equal 'omg', BaseMailer.deliveries.first.subject + end + protected # Execute the block setting the given values and restoring old values after |