From 99428602aa78aeb57d3a89888a1a0ebe0ed85d20 Mon Sep 17 00:00:00 2001 From: Marcello Barnaba Date: Mon, 23 May 2011 23:57:16 +0200 Subject: [PATCH] Refactored the with_body matcher using the with_part one --- lib/shoulda/matchers/action_mailer/have_sent_email.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/shoulda/matchers/action_mailer/have_sent_email.rb b/lib/shoulda/matchers/action_mailer/have_sent_email.rb index 56fbcf9f..436ab81e 100644 --- a/lib/shoulda/matchers/action_mailer/have_sent_email.rb +++ b/lib/shoulda/matchers/action_mailer/have_sent_email.rb @@ -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