2015-02-08 105 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