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之一。如何正確存根渲染方法?