https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292019-09-13T00:47:11ZRedmineRedmine - Patch #32025: mail_body method in test/test_helper.rb raises an exception if the message is not multiparthttps://www.redmine.org/issues/32025?journal_id=936922019-09-13T00:47:11ZGo MAEDA
<ul><li><strong>Target version</strong> set to <i>Candidate for next major release</i></li></ul><p>Thank you for catching and investigating the issue.</p>
<p>The root cause of the issue is that <code>mail_body</code> method in test/test_helper.rb supports only multi-part messages and does not support plaintext messages.</p>
<p>I think it is better to change <code>mail_body</code> method to support plaintext messages as well.</p>
<pre><code class="diff syntaxhl"><span class="gh">diff --git a/test/test_helper.rb b/test/test_helper.rb
index 390ea92b4..6a6fd7fa5 100644
</span><span class="gd">--- a/test/test_helper.rb
</span><span class="gi">+++ b/test/test_helper.rb
</span><span class="p">@@ -250,7 +250,7 @@</span> class ActiveSupport::TestCase
end
def mail_body(mail)
<span class="gd">- mail.parts.first.body.encoded
</span><span class="gi">+ (mail.multipart? ? mail.parts.first : mail).body.encoded
</span> end
# Returns the lft value for a new root issue
</code></pre> Redmine - Patch #32025: mail_body method in test/test_helper.rb raises an exception if the message is not multiparthttps://www.redmine.org/issues/32025?journal_id=936932019-09-13T01:58:13ZYuichi HARADA
<ul></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>The root cause of the issue is that <code>mail_body</code> method in test/test_helper.rb supports only multi-part messages and does not support plaintext messages.</p>
<p>I think it is better to change <code>mail_body</code> method to support plaintext messages as well.</p>
<p>[...]</p>
</blockquote>
<p>+1<br />I agree. Setting of <code>Setting.plain_text_mail</code> is not directly related to the acquisition of mail body.</p> Redmine - Patch #32025: mail_body method in test/test_helper.rb raises an exception if the message is not multiparthttps://www.redmine.org/issues/32025?journal_id=936972019-09-13T08:52:23ZGo MAEDA
<ul><li><strong>Subject</strong> changed from <i>RepositoryTest#test_scan_changesets_for_issue_ids randomly fails</i> to <i>mail_body method in test/test_helper.rb raises an exception if the message is not multipart</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Target version</strong> changed from <i>Candidate for next major release</i> to <i>4.1.0</i></li></ul><p>Committed the fix. Thank you for catching the issue.</p>