我正在尝试使用 RSpec (2.x) 在控制器中测试渲染方法。这是我的控制器中的代码:
respond_to 做 |格式| format.html # index.html.erb format.json { 渲染 :json => @entities, :include => :properties, :overview => options[:overview] } 结尾
这里是我在我的规范文件中尝试的测试:
controller.should_receive(:render).with(hash_include(:overview => true))
问题是 RSpec 告诉我没有为渲染提供任何参数(“得到:(无参数)”)。甚至不是 :json 之一。如何正确存根渲染方法?