diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-13 18:46:29 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-13 18:46:29 +0000 |
commit | f30462595e83f512cd5f29246a4542773595a224 (patch) | |
tree | 56eb7ce08ea5a8c6e0c21806e067c8c652e652b9 /test/unit/mail_handler_test.rb | |
parent | 3186130966cea85d842faf5c038006f8fb40bb61 (diff) | |
download | redmine-f30462595e83f512cd5f29246a4542773595a224.tar.gz redmine-f30462595e83f512cd5f29246a4542773595a224.zip |
Optional Regex delimiters to truncate incoming emails (#5864).
git-svn-id: http://svn.redmine.org/redmine/trunk@16065 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mail_handler_test.rb')
-rw-r--r-- | test/unit/mail_handler_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index c1afdaebd..898ccc918 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -977,6 +977,25 @@ class MailHandlerTest < ActiveSupport::TestCase end end + test "truncate emails using a regex delimiter" do + delimiter = "On .*, .* at .*, .* <.*<mailto:.*>> wrote:" + with_settings :mail_handler_enable_regex_delimiters => '1', :mail_handler_body_delimiters => delimiter do + issue = submit_email('ticket_reply_from_mail.eml') + assert_issue_created(issue) + assert issue.description.include?('This paragraph is before delimiter') + assert !issue.description.include?('On Wed, 11 Oct at 1:05 PM, Jon Smith <jsmith@somenet.foo<mailto:jsmith@somenet.foo>> wrote:') + assert !issue.description.include?('This paragraph is after the delimiter') + end + + with_settings :mail_handler_enable_regex_delimiters => '0', :mail_handler_body_delimiters => delimiter do + issue = submit_email('ticket_reply_from_mail.eml') + assert_issue_created(issue) + assert issue.description.include?('This paragraph is before delimiter') + assert issue.description.include?('On Wed, 11 Oct at 1:05 PM, Jon Smith <jsmith@somenet.foo<mailto:jsmith@somenet.foo>> wrote:') + assert issue.description.include?('This paragraph is after the delimiter') + end + end + def test_attachments_that_match_mail_handler_excluded_filenames_should_be_ignored with_settings :mail_handler_excluded_filenames => '*.vcf, *.jpg' do issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'}) |