aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/mail_service_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/test/mail_service_test.rb')
-rw-r--r--actionmailer/test/mail_service_test.rb28
1 files changed, 10 insertions, 18 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index f87d9b2e5b..51d722ea00 100644
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -545,7 +545,7 @@ class ActionMailerTest < Test::Unit::TestCase
assert_not_nil mail
mail, from, to = mail
- assert_equal 'system@loudthinking.com', from.addresses.first
+ assert_equal 'system@loudthinking.com', from
end
def test_reply_to
@@ -674,15 +674,12 @@ class ActionMailerTest < Test::Unit::TestCase
def test_doesnt_raise_errors_when_raise_delivery_errors_is_false
ActionMailer::Base.raise_delivery_errors = false
- TestMailer.delivery_method.expects(:perform_delivery).raises(Exception)
+ Mail::Message.any_instance.expects(:deliver!).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)
+ IO.expects(:popen).once.with('/usr/sbin/sendmail -i -t -f "system@loudthinking.com" test@localhost', 'w+')
ActionMailer::Base.delivery_method = :sendmail
TestMailer.deliver_signed_up(@recipient)
end
@@ -901,6 +898,7 @@ EOF
assert_equal "iso-8859-1", mail.parts[1].charset
assert_equal "image/jpeg", mail.parts[2].mime_type
+
assert_equal "attachment", mail.parts[2][:content_disposition].disposition_type
assert_equal "foo.jpg", mail.parts[2][:content_disposition].filename
assert_equal "foo.jpg", mail.parts[2][:content_type].filename
@@ -1038,7 +1036,7 @@ EOF
def test_empty_header_values_omitted
result = TestMailer.create_unnamed_attachment(@recipient).encoded
assert_match %r{Content-Type: application/octet-stream;}, result
- assert_match %r{Content-Disposition: attachment[^;]}, result
+ assert_match %r{Content-Disposition: attachment;}, result
end
def test_headers_with_nonalpha_chars
@@ -1072,12 +1070,7 @@ EOF
def test_return_path_with_create
mail = TestMailer.create_return_path
- assert_equal "another@somewhere.test", mail['return-path'].to_s
- end
-
- def test_return_path_with_create
- mail = TestMailer.create_return_path
- assert_equal ["another@somewhere.test"], mail.return_path
+ assert_equal "another@somewhere.test", mail.return_path
end
def test_return_path_with_deliver
@@ -1093,7 +1086,7 @@ EOF
end
def test_starttls_is_enabled_if_supported
- ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
+ ActionMailer::Base.delivery_settings[:smtp].merge!(:enable_starttls_auto => true)
MockSMTP.any_instance.expects(:respond_to?).with(:enable_starttls_auto).returns(true)
MockSMTP.any_instance.expects(:enable_starttls_auto)
ActionMailer::Base.delivery_method = :smtp
@@ -1101,7 +1094,7 @@ EOF
end
def test_starttls_is_disabled_if_not_supported
- ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
+ ActionMailer::Base.delivery_settings[:smtp].merge!(:enable_starttls_auto => true)
MockSMTP.any_instance.expects(:respond_to?).with(:enable_starttls_auto).returns(false)
MockSMTP.any_instance.expects(:enable_starttls_auto).never
ActionMailer::Base.delivery_method = :smtp
@@ -1109,13 +1102,12 @@ EOF
end
def test_starttls_is_not_enabled
- ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false
+ ActionMailer::Base.delivery_settings[:smtp].merge!(:enable_starttls_auto => false)
MockSMTP.any_instance.expects(:respond_to?).never
- MockSMTP.any_instance.expects(:enable_starttls_auto).never
ActionMailer::Base.delivery_method = :smtp
TestMailer.deliver_signed_up(@recipient)
ensure
- ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
+ ActionMailer::Base.delivery_settings[:smtp].merge!(:enable_starttls_auto => true)
end
end