我重构了我OrgController
的使用respond_with
,现在控制器规范脚手架失败并显示此消息:
1) OrgsController POST create with invalid params re-renders the 'new' template
Failure/Error: response.should render_template("new")
expecting <"new"> but rendering with <"">
规范如下所示:
it "re-renders the 'new' template" do
Org.any_instance.stub(:save).and_return(false)
post :create, {:org => {}}, valid_session
response.should render_template("new")
end
我读过我应该对:errors
哈希进行存根以使其看起来有错误。最好的方法是什么?