summaryrefslogtreecommitdiffstats
path: root/test/unit/mail_handler_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2016-03-04 06:55:55 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2016-03-04 06:55:55 +0000
commite28cc10a35a9390faef72689148e762ac3425ae0 (patch)
tree916b772fee06bf61ac61edb35f134c74c99ed92a /test/unit/mail_handler_test.rb
parent3ac315301a1221f37996cbdf1cbde12740a38912 (diff)
downloadredmine-e28cc10a35a9390faef72689148e762ac3425ae0.tar.gz
redmine-e28cc10a35a9390faef72689148e762ac3425ae0.zip
add test which ensure received mail text attachment keeps original encoding (#21742)
This test fails on Ruby >= 2.1 and will be fixed by next revision. Contributed by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@15183 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mail_handler_test.rb')
-rw-r--r--test/unit/mail_handler_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 47e642e91..c92c1e3c8 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -578,6 +578,22 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest
end
+ def test_mail_with_attachment_latin2
+ issue = submit_email(
+ 'ticket_with_text_attachment_iso-8859-2.eml',
+ :issue => {:project => 'ecookbook'}
+ )
+ assert_kind_of Issue, issue
+ assert_equal 1, issue.attachments.size
+ attachment = issue.attachments.first
+ assert_equal 'latin2.txt', attachment.filename
+ assert_equal 19, attachment.filesize
+ assert File.exist?(attachment.diskfile)
+ assert_equal 19, File.size(attachment.diskfile)
+ content = "p\xF8\xEDli\xB9 \xBEluou\xE8k\xFD k\xF9n".force_encoding('CP852')
+ assert_equal content, File.read(attachment.diskfile).force_encoding('CP852')
+ end
+
def test_multiple_inline_text_parts_should_be_appended_to_issue_description
issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'})
assert_include 'first', issue.description