aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-03-28 11:34:30 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-03-28 11:34:30 -0700
commit154f9ce5fdf5fd4c762a71a87b66363578c145d0 (patch)
tree873f8a012d6948024fd2492f6b95db6cfa042145 /actionmailer
parent7e3b4c1f2f0c435f1fa5f8f093ce6934d6a1207d (diff)
parent53bcd4af093854a0826480473533c702a8f80b88 (diff)
downloadrails-154f9ce5fdf5fd4c762a71a87b66363578c145d0.tar.gz
rails-154f9ce5fdf5fd4c762a71a87b66363578c145d0.tar.bz2
rails-154f9ce5fdf5fd4c762a71a87b66363578c145d0.zip
Merge remote branch 'mikel/master'
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/actionmailer.gemspec2
-rw-r--r--actionmailer/test/base_test.rb34
-rw-r--r--actionmailer/test/old_base/mail_service_test.rb6
3 files changed, 29 insertions, 13 deletions
diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec
index a7a2599105..3e40897d60 100644
--- a/actionmailer/actionmailer.gemspec
+++ b/actionmailer/actionmailer.gemspec
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
s.has_rdoc = true
s.add_dependency('actionpack', version)
- s.add_dependency('mail', '~> 2.1.3')
+ s.add_dependency('mail', '~> 2.1.5')
s.add_dependency('text-format', '~> 1.0.0')
end
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 6f274c11df..baeee542be 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -39,8 +39,15 @@ class BaseTest < ActiveSupport::TestCase
end
def attachment_with_hash
- attachments['invoice.jpg'] = { :data => "you smiling", :mime_type => "image/x-jpg",
- :transfer_encoding => "base64" }
+ attachments['invoice.jpg'] = { :data => "\312\213\254\232)b",
+ :mime_type => "image/x-jpg",
+ :transfer_encoding => "base64" }
+ mail
+ end
+
+ def attachment_with_hash_default_encoding
+ attachments['invoice.jpg'] = { :data => "\312\213\254\232)b",
+ :mime_type => "image/x-jpg" }
mail
end
@@ -135,13 +142,13 @@ class BaseTest < ActiveSupport::TestCase
:mime_version => '2.0',
:reply_to => 'reply-to@test.lindsaar.net',
:date => @time)
- assert_equal(['bcc@test.lindsaar.net'], email.bcc)
- assert_equal(['cc@test.lindsaar.net'], email.cc)
- assert_equal('multipart/mixed', email.content_type)
- assert_equal('iso-8559-1', email.charset)
- assert_equal('2.0', email.mime_version)
- assert_equal(['reply-to@test.lindsaar.net'], email.reply_to)
- assert_equal(@time, email.date)
+ assert_equal(['bcc@test.lindsaar.net'], email.bcc)
+ assert_equal(['cc@test.lindsaar.net'], email.cc)
+ assert_equal('multipart/mixed; charset=iso-8559-1', email.content_type)
+ assert_equal('iso-8559-1', email.charset)
+ assert_equal('2.0', email.mime_version)
+ assert_equal(['reply-to@test.lindsaar.net'], email.reply_to)
+ assert_equal(@time, email.date)
end
test "mail() renders the template using the method being processed" do
@@ -206,6 +213,15 @@ class BaseTest < ActiveSupport::TestCase
assert_equal expected, email.attachments['invoice.jpg'].decoded
end
+ test "attachment with hash using default mail encoding" do
+ email = BaseMailer.attachment_with_hash_default_encoding
+ assert_equal(1, email.attachments.length)
+ assert_equal('invoice.jpg', email.attachments[0].filename)
+ expected = "\312\213\254\232)b"
+ expected.force_encoding(Encoding::BINARY) if '1.9'.respond_to?(:force_encoding)
+ assert_equal expected, email.attachments['invoice.jpg'].decoded
+ end
+
test "sets mime type to multipart/mixed when attachment is included" do
email = BaseMailer.attachment_with_content
assert_equal(1, email.attachments.length)
diff --git a/actionmailer/test/old_base/mail_service_test.rb b/actionmailer/test/old_base/mail_service_test.rb
index e49307bfda..9eb067554f 100644
--- a/actionmailer/test/old_base/mail_service_test.rb
+++ b/actionmailer/test/old_base/mail_service_test.rb
@@ -784,7 +784,7 @@ EOF
expected.date = Time.local 2004, 12, 12
created = TestMailer.utf8_body @recipient
- assert_match(/åœö blah/, created.encoded)
+ assert_match(/åœö blah/, created.decoded)
end
def test_multiple_utf8_recipients
@@ -1019,8 +1019,8 @@ EOF
def test_empty_header_values_omitted
result = TestMailer.unnamed_attachment(@recipient).encoded
- assert_match %r{Content-Type: application/octet-stream;}, result
- assert_match %r{Content-Disposition: attachment;}, result
+ assert_match %r{Content-Type: application/octet-stream}, result
+ assert_match %r{Content-Disposition: attachment}, result
end
def test_headers_with_nonalpha_chars