summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-11-02 19:00:31 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-11-02 19:00:31 +0000
commit0395eb99decaac54dc8acf6162b3129893341be0 (patch)
tree134bc8837aab44633bfd8d5375c10c2c97912196 /test/unit
parenta04d64881cca1f741437cb57e44f3434bd8a7eb1 (diff)
downloadredmine-0395eb99decaac54dc8acf6162b3129893341be0.tar.gz
redmine-0395eb99decaac54dc8acf6162b3129893341be0.zip
Remove email quotes (>) when searching for incoming email delimiters. #2852 #6628
Changes the email truncation so a delimiter can be prefixed by email quotes or spaces ("> Eric said..."). This will let it be combined with a "--- Reply above ---" delimiter to match "> --- Reply above ---" git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4361 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/mail_handler_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 947845a58..e59d78be9 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -335,6 +335,38 @@ class MailHandlerTest < ActiveSupport::TestCase
end
end
+ context "with a single quoted reply (e.g. reply to a Redmine email notification)" do
+ setup do
+ Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---'
+ end
+
+ should "truncate the email at the delimiter with the quoted reply symbols (>)" do
+ journal = submit_email('issue_update_with_quoted_reply_above.eml')
+ assert journal.is_a?(Journal)
+ assert journal.notes.include?('An update to the issue by the sender.')
+ assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---"))
+ assert !journal.notes.include?('Looks like the JSON api for projects was missed.')
+
+ end
+
+ end
+
+ context "with multiple quoted replies (e.g. reply to a reply of a Redmine email notification)" do
+ setup do
+ Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---'
+ end
+
+ should "truncate the email at the delimiter with the quoted reply symbols (>)" do
+ journal = submit_email('issue_update_with_multiple_quoted_reply_above.eml')
+ assert journal.is_a?(Journal)
+ assert journal.notes.include?('An update to the issue by the sender.')
+ assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---"))
+ assert !journal.notes.include?('Looks like the JSON api for projects was missed.')
+
+ end
+
+ end
+
context "with multiple strings" do
setup do
Setting.mail_handler_body_delimiters = "---\nBREAK"