2
我想在RSpec(2.x)控制器中测试渲染方法。 下面的代码在我的控制器:测试与RSpec控制器中的渲染方法
respond_to do |format| format.html # index.html.erb format.json { render :json => @entities, :include => :properties, :overview => options[:overview] } end
而且这里的测试中,我尝试在我的spec文件:
controller.should_receive(:render).with(hash_including(:overview => true))
的问题是,RSpec的告诉我,提供了渲染没有参数(“得到:(无参数)“)。甚至没有:json之一。如何正确存根渲染方法?