在我的 ActionMailer::TestCase 测试中,我期待:
@expected.to = BuyadsproMailer.group_to(campaign.agency.users)
@expected.subject = "You submitted #{offer_log.total} worth of offers for #{offer_log.campaign.name} "
@expected.from = "BuyAds Pro <feedback@buyads.com>"
@expected.body = read_fixture('deliver_to_agency')
@expected.content_type = "multipart/mixed;\r\n boundary=\"something\""
@expected.attachments["#{offer_log.aws_key}.pdf"] = {
:mime_type => 'application/pdf',
:content => fake_pdf.body
}
并存根我的邮件以获取 fake_pdf 而不是通常从 S3 获取的真实 PDF,以便我确定 PDF 的正文匹配。
但是,我收到这个很长的错误,告诉我应该收到一封电子邮件,但收到的电子邮件略有不同:
<...Mime-Version: 1.0\r\nContent-Type: multipart/mixed\r\nContent-Transfer-Encoding: 7bit...> expected but was
<...Mime-Version: 1.0\r\nContent-Type: multipart/mixed;\r\n boundary=\"--==_mimepart_50f06fa9c06e1_118dd3fd552035ae03352b\";\r\n charset=UTF-8\r\nContent-Transfer-Encoding: 7bit...>
我不匹配生成的电子邮件的字符集或部分边界。
如何定义或存根预期电子邮件的这一方面?