27691-test.patch

Yuichi HARADA, 2018-10-15 09:20

Download (1.68 KB)

View differences:

test/fixtures/mail_handler/ticket_with_utf8_body_and_lf_line_terminator.eml
1
Return-Path: <jsmith@somenet.foo>
2
Received: from osiris ([127.0.0.1])
3
	by OSIRIS
4
	with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
5
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
6
From: "John Smith" <jsmith@somenet.foo>
7
To: <redmine@somenet.foo>
8
Subject: New ticket on UTF-8 body and LF line terminator
9
Date: Sun, 22 Jun 2008 12:28:07 +0200
10
MIME-Version: 1.0
11
Content-Type: text/plain;
12
	format=flowed;
13
	charset="utf-8";
14
	reply-type=original
15
Content-Transfer-Encoding: 8bit
16

  
17
Hello
18
こんにちは
test/unit/mail_handler_test.rb
1164 1164
    assert_equal false, MailHandler.safe_receive
1165 1165
  end
1166 1166

  
1167
  def test_add_issue_with_utf8_body_and_lf_line_terminator
1168
    issue =
1169
      submit_email('ticket_with_utf8_body_and_lf_line_terminator.eml',
1170
        :issue => {:project => 'ecookbook'}
1171
      ) do |email|
1172
        # Ensure that line terminators are LF
1173
        email.gsub!("\r\n", "\n")
1174
      end
1175
    assert issue.is_a?(Issue)
1176
    issue.reload
1177
    assert_equal 'New ticket on UTF-8 body and LF line terminator', issue.subject
1178
    assert_equal "Hello\r\nこんにちは", issue.description
1179
  end
1180

  
1167 1181
  private
1168 1182

  
1169 1183
  def submit_email(filename, options={})