2015-02-08 55 views
0

我试图通过这个screencast的帮助来学习在rails中的测试。但是,我被卡住,这一步Rspec邮件对象不响应包含?

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

的错误消息是

expected #<Mail::Message:47172420, Multipart: true, Headers: <Date: Sun, 08 Feb 2015 09:51:56 +0530>, <From: [email protected]>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: Password Reset>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="--==_mimepart_54d6e4642e9e_1450a1b328155a"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>> to include "[email protected]", but it does not respond to `include?` 

邮件对象不回应“包括哪些内容?”。这可能是由于rspec语法的改变,或者是代码有问题。提前感谢您的答复。

回答

1

貌似你不调用last_emailto

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

感谢。得到它的工作。 – prajwaldp 2015-02-08 05:17:13