diff options
author | Go MAEDA <maeda@farend.jp> | 2018-11-23 06:07:32 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-11-23 06:07:32 +0000 |
commit | f743d2356f1f94fc6bb32355824cc074f4896fb7 (patch) | |
tree | 1f4e2c53404d68146766598d6363c7e9b1d71a96 /test | |
parent | f63d0435dfd77ed0b6d3014bc7609be82845a652 (diff) | |
download | redmine-f743d2356f1f94fc6bb32355824cc074f4896fb7.tar.gz redmine-f743d2356f1f94fc6bb32355824cc074f4896fb7.zip |
Fix: Attachments are added even if validation fails when updating an issue via email (#28576).
Patch by Takenori TAKAKI.
git-svn-id: http://svn.redmine.org/redmine/trunk@17630 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/mail_handler_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index e63ab0958..5c3a570b7 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -890,6 +890,21 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'Paella.jpg', detail.value end + def test_update_issue_should_discard_all_changes_on_validation_failure + Issue.any_instance.stubs(:valid?).returns(false) + assert_no_difference 'Journal.count' do + assert_no_difference 'JournalDetail.count' do + assert_no_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 + end + def test_update_issue_should_send_email_notification journal = submit_email('ticket_reply.eml') assert journal.is_a?(Journal) |