summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-24 09:34:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-24 09:34:23 +0000
commit49900051ea2b404161dae568eeaec6f26bbe0c9d (patch)
tree58ac20243f4efdfd5f0baeb1e3cb0aec58b071cf /test
parent9957883c4ddf53cbbee40e8c952f0a7aa0d703ca (diff)
downloadredmine-49900051ea2b404161dae568eeaec6f26bbe0c9d.tar.gz
redmine-49900051ea2b404161dae568eeaec6f26bbe0c9d.zip
Fixed: MailHandler does not include JournalDetail for attached files (#7966).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6312 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/mail_handler_test.rb29
1 files changed, 25 insertions, 4 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index d272e6090..a80f1ec16 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -307,7 +307,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 1, ActionMailer::Base.deliveries.size
end
- def test_add_issue_note
+ def test_update_issue
journal = submit_email('ticket_reply.eml')
assert journal.is_a?(Journal)
assert_equal User.find_by_login('jsmith'), journal.user
@@ -316,7 +316,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'Feature request', journal.issue.tracker.name
end
- def test_add_issue_note_with_attribute_changes
+ def test_update_issue_with_attribute_changes
# This email contains: 'Status: Resolved'
journal = submit_email('ticket_reply_with_status.eml')
assert journal.is_a?(Journal)
@@ -334,15 +334,36 @@ class MailHandlerTest < ActiveSupport::TestCase
assert !journal.notes.match(/^Status:/i)
assert !journal.notes.match(/^Start Date:/i)
end
+
+ def test_update_issue_with_attachment
+ assert_difference 'Journal.count' do
+ assert_difference 'JournalDetail.count' do
+ assert_difference 'Attachment.count' do
+ assert_no_difference 'Issue.count' do
+ journal = submit_email('ticket_with_attachment.eml') do |raw|
+ raw.gsub! /^Subject: .*$/, 'Subject: Re: [Cookbook - Feature #2] (New) Add ingredients categories'
+ end
+ end
+ end
+ end
+ end
+ journal = Journal.first(:order => 'id DESC')
+ assert_equal Issue.find(2), journal.journalized
+ assert_equal 1, journal.details.size
+
+ detail = journal.details.first
+ assert_equal 'attachment', detail.property
+ assert_equal 'Paella.jpg', detail.value
+ end
- def test_add_issue_note_should_send_email_notification
+ def test_update_issue_should_send_email_notification
ActionMailer::Base.deliveries.clear
journal = submit_email('ticket_reply.eml')
assert journal.is_a?(Journal)
assert_equal 1, ActionMailer::Base.deliveries.size
end
- def test_add_issue_note_should_not_set_defaults
+ def test_update_issue_should_not_set_defaults
journal = submit_email('ticket_reply.eml', :issue => {:tracker => 'Support request', :priority => 'High'})
assert journal.is_a?(Journal)
assert_match /This is reply/, journal.notes