test_add_issue_with_iso_2022_jp_ms_subject.diff

A test to detect the problem - Go MAEDA, 2018-08-27 13:14

Download (1.61 KB)

View differences:

test/fixtures/mail_handler/subject_japanese_3.eml (working copy)
1
From: John Smith <JSmith@somenet.foo>
2
To: "redmine@somenet.foo" <redmine@somenet.foo>
3
Subject: =?iso-2022-jp?B?GyRCLSEbKEIgGyRCNF0/dDt6JUYlOSVIGyhC?=
4
Date: Mon, 27 Aug 2018 09:30:00 +0900
5
Message-ID: <87C31D42249DD0489D1A1444E3232DD7019D6183@foo.bar>
6

  
7
The subject contains a "CIRCLED DIGIT ONE" character (U+2460).
8
It is undefined in ISO-2022-JP but defined in some vendor-extended
9
variants define it.
test/unit/mail_handler_test.rb (working copy)
739 739
    assert_equal ja, issue.subject
740 740
  end
741 741

  
742
  def test_add_issue_with_iso_2022_jp_ms_subject
743
    issue = submit_email(
744
              'subject_japanese_3.eml',
745
              :issue => {:project => 'ecookbook'}
746
            )
747
    assert_kind_of Issue, issue
748
    # The original subject is "① 丸数字テスト".
749
    # CIRCLED DIGIT ONE character is not defined in ISO-2022-JP but
750
    # defined in some vendor-extended variants such as ISO-2022-JP-MS.
751
    # The character should be replaced with the replacement character
752
    # instead of breaking the whole subject.
753
    assert_match /丸数字テスト/, issue.subject
754
    byebug
755
  end
756

  
742 757
  def test_should_ignore_emails_from_locked_users
743 758
    User.find(2).lock!
744 759