##// END OF EJS Templates
code clean up MailHandlerTest unit test....
Toshi MARUYAMA -
r5439:d5b97d49c610
parent child
Show More
@@ -138,7 +138,6 class MailHandlerTest < ActiveSupport::TestCase
138 assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')
138 assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')
139 end
139 end
140
140
141
142 def test_add_issue_with_attachment_to_specific_project
141 def test_add_issue_with_attachment_to_specific_project
143 issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'})
142 issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'})
144 assert issue.is_a?(Issue)
143 assert issue.is_a?(Issue)
@@ -385,7 +384,6 class MailHandlerTest < ActiveSupport::TestCase
385 setup do
384 setup do
386 Setting.mail_handler_body_delimiters = '---'
385 Setting.mail_handler_body_delimiters = '---'
387 end
386 end
388
389 should "truncate the email at the delimiter for the issue" do
387 should "truncate the email at the delimiter for the issue" do
390 issue = submit_email('ticket_on_given_project.eml')
388 issue = submit_email('ticket_on_given_project.eml')
391 assert_issue_created(issue)
389 assert_issue_created(issue)
@@ -400,39 +398,32 class MailHandlerTest < ActiveSupport::TestCase
400 setup do
398 setup do
401 Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---'
399 Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---'
402 end
400 end
403
404 should "truncate the email at the delimiter with the quoted reply symbols (>)" do
401 should "truncate the email at the delimiter with the quoted reply symbols (>)" do
405 journal = submit_email('issue_update_with_quoted_reply_above.eml')
402 journal = submit_email('issue_update_with_quoted_reply_above.eml')
406 assert journal.is_a?(Journal)
403 assert journal.is_a?(Journal)
407 assert journal.notes.include?('An update to the issue by the sender.')
404 assert journal.notes.include?('An update to the issue by the sender.')
408 assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---"))
405 assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---"))
409 assert !journal.notes.include?('Looks like the JSON api for projects was missed.')
406 assert !journal.notes.include?('Looks like the JSON api for projects was missed.')
410
411 end
407 end
412
413 end
408 end
414
409
415 context "with multiple quoted replies (e.g. reply to a reply of a Redmine email notification)" do
410 context "with multiple quoted replies (e.g. reply to a reply of a Redmine email notification)" do
416 setup do
411 setup do
417 Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---'
412 Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---'
418 end
413 end
419
420 should "truncate the email at the delimiter with the quoted reply symbols (>)" do
414 should "truncate the email at the delimiter with the quoted reply symbols (>)" do
421 journal = submit_email('issue_update_with_multiple_quoted_reply_above.eml')
415 journal = submit_email('issue_update_with_multiple_quoted_reply_above.eml')
422 assert journal.is_a?(Journal)
416 assert journal.is_a?(Journal)
423 assert journal.notes.include?('An update to the issue by the sender.')
417 assert journal.notes.include?('An update to the issue by the sender.')
424 assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---"))
418 assert !journal.notes.match(Regexp.escape("--- Reply above. Do not remove this line. ---"))
425 assert !journal.notes.include?('Looks like the JSON api for projects was missed.')
419 assert !journal.notes.include?('Looks like the JSON api for projects was missed.')
426
427 end
420 end
428
429 end
421 end
430
422
431 context "with multiple strings" do
423 context "with multiple strings" do
432 setup do
424 setup do
433 Setting.mail_handler_body_delimiters = "---\nBREAK"
425 Setting.mail_handler_body_delimiters = "---\nBREAK"
434 end
426 end
435
436 should "truncate the email at the first delimiter found (BREAK)" do
427 should "truncate the email at the first delimiter found (BREAK)" do
437 issue = submit_email('ticket_on_given_project.eml')
428 issue = submit_email('ticket_on_given_project.eml')
438 assert_issue_created(issue)
429 assert_issue_created(issue)
General Comments 0
You need to be logged in to leave comments. Login now