28576.patch

Takenori TAKAKI, 2018-10-04 04:03

Download (1.51 KB)

View differences:

app/models/mail_handler.rb
250 250

  
251 251
    # add To and Cc as watchers before saving so the watchers can reply to Redmine
252 252
    add_watchers(issue)
253
    add_attachments(issue)
254 253
    issue.save!
254
    add_attachments(issue)
255 255
    if logger
256 256
      logger.info "MailHandler: issue ##{issue.id} updated by #{user}"
257 257
    end
test/unit/mail_handler_test.rb
874 874
    assert_equal 'Paella.jpg', detail.value
875 875
  end
876 876

  
877
  def test_update_issue_should_discard_all_changes_on_validation_failure
878
    Issue.any_instance.stubs(:valid?).returns(false)
879
    assert_no_difference 'Journal.count' do
880
      assert_no_difference 'JournalDetail.count' do
881
        assert_no_difference 'Attachment.count' do
882
          assert_no_difference 'Issue.count' do
883
            journal = submit_email('ticket_with_attachment.eml') do |raw|
884
              raw.gsub! /^Subject: .*$/, 'Subject: Re: [Cookbook - Feature #2] (New) Add ingredients categories'
885
            end
886
          end
887
        end
888
      end
889
    end
890
  end
891

  
877 892
  def test_update_issue_should_send_email_notification
878 893
    journal = submit_email('ticket_reply.eml')
879 894
    assert journal.is_a?(Journal)