[英]How do I expect a message whose argument is any instance of a class in RSpec?
我該如何編寫期望被類的任何實例調用的消息? 我想做這樣的事情:
@controller.should_receive(:sign_in_and_redirect).with(kind_of? User)
@controller.should_receive(:sign_in_and_redirect).with(an_instance_of(User))
有關更多詳細信息,請參見Relish文檔的“參數匹配器”部分。 我鏈接到RSpec 2.13文檔,但是應該有一個選擇框,允許您根據需要更改文檔版本。
更新:
在RSpec 3.2文檔中 ,他們說要使用instance_of
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.