mirror of
https://github.com/github/rails.git
synced 2026-01-28 07:48:00 -05:00
Make TMail::Mail#has_attachments? use logic from #attachment? (closes #3815) [devslashnull@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3652 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -7,7 +7,7 @@ module TMail
|
||||
|
||||
class Mail
|
||||
def has_attachments?
|
||||
multipart? && parts.any? { |part| part.header["content-type"].main_type != "text" }
|
||||
multipart? && parts.any? { |part| attachment?(part) }
|
||||
end
|
||||
|
||||
def attachment?(part)
|
||||
|
||||
@@ -590,6 +590,7 @@ EOF
|
||||
def test_attachment_with_text_type
|
||||
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email13")
|
||||
mail = TMail::Mail.parse(fixture)
|
||||
assert mail.has_attachments?
|
||||
assert_equal 1, mail.attachments.length
|
||||
assert_equal "hello.rb", mail.attachments.first.original_filename
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user