Rspec 邮件对象不响应包含?

Rspec Mail object does not respond to include?

我正在尝试借助此 screencast 在 rails 中学习测试。但是我卡在了这一步

expect(last_email).to include(user.email)

错误信息是

expected #<Mail::Message:47172420, Multipart: true, Headers: <Date: Sun, 08 Feb 2015 09:51:56 +0530>, <From: from@example.com>, <To: person1@example.com>, <Message-ID: <54d6e464682e_1450a1b32815670@User-PC.mail>>, <Subject: Password Reset>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="--==_mimepart_54d6e4642e9e_1450a1b328155a"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>> to include "person1@example.com", but it does not respond to `include?`  

邮件对象不响应 'include?'。这可能是由于 rspec 语法的更改还是代码有问题。提前感谢您的回答。

您似乎没有在 last_email 上呼叫 to:

expect(last_email.to).to include(user.email)