在我们的rails 3.1.4 app中,rspec用于测试应用程序控制器中的公共方法require_signin.这是方法require_signin:
def require_signin if !signed_in? flash.Now.alert = "Log in first!" redirect_to signin_path end end
这是rspec代码:
it "should invoke require_signin for those without login" do controller.send(:require_signin) controller {should redirect_to signin_path} end
RuntimeError:←[0m ←[31mActionController::RackDelegation#status= delegated to @_response.status=,but @_response is nil: #<ApplicationController:0x3 a67f10 @_routes=nil,@_action_has_layout=true,@_view_context_class=nil,@_headers={"Content-Type"=>"text/html"},@_status=200,@_reques t=#<ActionController::TestRequest:0x3a68720 @env={"rack.version"=>[1,1],"rack.input"=>#<StringIO:0x34fad60>,........
rspec代码有什么问题?非常感谢.
解决方法
原文地址:https://www.jb51.cc/ruby/269931.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。