summaryrefslogtreecommitdiffstats
path: root/test/unit/mail_handler_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-09-29 11:50:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-09-29 11:50:49 +0000
commitcfc05d310e711de8326fbf9e71cbe7ffb264c54a (patch)
tree01de23a22d2f01dfa81e728e36bdd61a5e14c0e0 /test/unit/mail_handler_test.rb
parent2c97f9ecde0df139a7dff3582200b2af54d8b1c0 (diff)
downloadredmine-cfc05d310e711de8326fbf9e71cbe7ffb264c54a.tar.gz
redmine-cfc05d310e711de8326fbf9e71cbe7ffb264c54a.zip
Exclude attachments from incoming emails based on file name (#3413).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12167 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mail_handler_test.rb')
-rw-r--r--test/unit/mail_handler_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 3244d8cd2..7e0f80cf3 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -759,6 +759,24 @@ class MailHandlerTest < ActiveSupport::TestCase
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'})
+ assert issue.is_a?(Issue)
+ assert !issue.new_record?
+ assert_equal 0, issue.reload.attachments.size
+ end
+ end
+
+ def test_attachments_that_do_not_match_mail_handler_excluded_filenames_should_be_attached
+ with_settings :mail_handler_excluded_filenames => '*.vcf, *.gif' do
+ issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'})
+ assert issue.is_a?(Issue)
+ assert !issue.new_record?
+ assert_equal 1, issue.reload.attachments.size
+ end
+ end
+
def test_email_with_long_subject_line
issue = submit_email('ticket_with_long_subject.eml')
assert issue.is_a?(Issue)