Refactored the with_body matcher using the with_part one

This commit is contained in:
Marcello Barnaba 2011-05-23 23:57:16 +02:00 committed by Jason Morrison
parent d468d3b79d
commit 99428602aa
1 changed files with 1 additions and 3 deletions

View File

@ -135,9 +135,7 @@ module Shoulda # :nodoc:
# body if the e-mail is multipart. TMail concatenates the
# String representation of each part instead.
if mail.body.blank? && mail.multipart?
mail.parts.select {|p| p.content_type =~ /^text\//}.all? do |part|
regexp_or_string_match(part.body, a_regexp_or_string)
end
part_match(mail, /^text\//, a_regexp_or_string)
else
regexp_or_string_match(mail.body, a_regexp_or_string)
end