diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-20 06:50:43 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-20 06:50:43 +0000 |
commit | e963354124d27bdae0420ae0614335d251be8d51 (patch) | |
tree | f6044aa10f5502ef7f4d3e5a4daff345032fbb40 /actionmailer/test | |
parent | bf280157d9c92637a3a270510b2ff67be27a302e (diff) | |
download | rails-e963354124d27bdae0420ae0614335d251be8d51.tar.gz rails-e963354124d27bdae0420ae0614335d251be8d51.tar.bz2 rails-e963354124d27bdae0420ae0614335d251be8d51.zip |
Increase mail delivery test coverage. Closes #8692.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7070 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 13 | ||||
-rw-r--r-- | actionmailer/test/test_helper_test.rb | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 2532760b4a..132a714cb1 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -276,7 +276,7 @@ class ActionMailerTest < Test::Unit::TestCase def setup ActionMailer::Base.delivery_method = :test ActionMailer::Base.perform_deliveries = true - ActionMailer::Base.raise_delivery_errors + ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.deliveries = [] @original_logger = TestMailer.logger @@ -489,7 +489,16 @@ class ActionMailerTest < Test::Unit::TestCase TestMailer.any_instance.expects(:perform_delivery_test).raises(Exception) assert_nothing_raised { TestMailer.deliver_signed_up(@recipient) } end - + + def test_performs_delivery_via_sendmail + sm = mock() + sm.expects(:print).with(anything) + sm.expects(:flush) + IO.expects(:popen).once.with('/usr/sbin/sendmail -i -t', 'w+').yields(sm) + ActionMailer::Base.delivery_method = :sendmail + TestMailer.deliver_signed_up(@recipient) + end + def test_delivery_logs_sent_mail mail = TestMailer.create_signed_up(@recipient) logger = mock() diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index a22e7a5991..08f92865ca 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -38,6 +38,19 @@ class TestHelperTest < Test::Unit::TestCase end end + def test_assert_emails_with_no_block + assert_nothing_raised do + TestHelperMailer.deliver_test + assert_emails 1 + end + + assert_nothing_raised do + TestHelperMailer.deliver_test + TestHelperMailer.deliver_test + assert_emails 3 + end + end + def test_assert_no_emails assert_nothing_raised do assert_no_emails do |