aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/base_test.rb
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-24 20:38:53 +1100
committerJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-24 20:38:53 +1100
commit73a9000402b5766e660dbf3489f5289c21c3f472 (patch)
treefcbbb7b0161ae9299c67bcbbdcd2d51900678a73 /actionmailer/test/base_test.rb
parentafc758297c553de467b0c434330cb703d62795f1 (diff)
downloadrails-73a9000402b5766e660dbf3489f5289c21c3f472.tar.gz
rails-73a9000402b5766e660dbf3489f5289c21c3f472.tar.bz2
rails-73a9000402b5766e660dbf3489f5289c21c3f472.zip
Adding failing tests for calling just the action, instead of :create_action_name and :deliver_action_name
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r--actionmailer/test/base_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 0b650e9a28..7f41f3485c 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -327,7 +327,21 @@ class BaseTest < ActiveSupport::TestCase
test "ActionMailer should be told when Mail gets delivered" do
BaseMailer.deliveries.clear
BaseMailer.expects(:delivered_email).once
- email = BaseMailer.deliver_welcome
+ BaseMailer.deliver_welcome
+ assert_equal(1, BaseMailer.deliveries.length)
+ end
+
+ test "Calling just the action should return the generated mail object" do
+ BaseMailer.deliveries.clear
+ email = BaseMailer.welcome
+ assert_equal(0, BaseMailer.deliveries.length)
+ assert_equal('The first email on new API!', email.subject)
+ end
+
+ test "Calling deliver on the action should deliver the mail object" do
+ BaseMailer.deliveries.clear
+ BaseMailer.expects(:delivered_email).once
+ BaseMailer.welcome.deliver
assert_equal(1, BaseMailer.deliveries.length)
end