diff options
author | Michael Koziarski <michael@koziarski.com> | 2009-11-28 13:34:05 +1300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-11-28 13:34:05 +1300 |
commit | 7e0aa35c20f06fd9ef245155e30e81cfb38bad05 (patch) | |
tree | f35b95439cb1d4a9575de594505acfd023cfc06c /actionmailer/test | |
parent | 02c3c9dfbcec05e3b0cecc062da8acd0cf7c53e0 (diff) | |
download | rails-7e0aa35c20f06fd9ef245155e30e81cfb38bad05.tar.gz rails-7e0aa35c20f06fd9ef245155e30e81cfb38bad05.tar.bz2 rails-7e0aa35c20f06fd9ef245155e30e81cfb38bad05.zip |
avoid generating invalid SMTP commands in ruby pre 1.9
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Conflicts:
actionmailer/lib/action_mailer/base.rb
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/mail_service_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index c98f0a7601..697265b8ec 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -31,6 +31,18 @@ class TestMailer < ActionMailer::Base render :text => "Goodbye, Mr. #{recipient}" end + def from_with_name + from "System <system@loudthinking.com>" + recipients "root@loudthinking.com" + body "Nothing to see here." + end + + def from_without_name + from "system@loudthinking.com" + recipients "root@loudthinking.com" + body "Nothing to see here." + end + def cc_bcc(recipient) recipients recipient subject "testing bcc/cc" @@ -487,6 +499,28 @@ class ActionMailerTest < Test::Unit::TestCase assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded end + def test_from_without_name_for_smtp + ActionMailer::Base.delivery_method = :smtp + TestMailer.deliver_from_without_name + + mail = MockSMTP.deliveries.first + assert_not_nil mail + mail, from, to = mail + + assert_equal 'system@loudthinking.com', from.to_s + end + + def test_from_with_name_for_smtp + ActionMailer::Base.delivery_method = :smtp + TestMailer.deliver_from_with_name + + mail = MockSMTP.deliveries.first + assert_not_nil mail + mail, from, to = mail + + assert_equal 'system@loudthinking.com', from.to_s + end + def test_reply_to expected = new_mail |