这是我的密码:
before(:each) do
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials(api_key.access_token)
end我的测试本应通过,但它显示了以下错误:
Failure/Error: request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials("#{api_key.access_token}")
ArgumentError:
wrong number of arguments (0 for 1..2) 发布于 2014-02-11 21:54:43
您在测试中访问的request方法在http://rubydoc.info/gems/rack-test/0.6.2/Rack/Test/Session:request中有文档记录,并期望错误指示的参数为1或2个。您在request.env上得到了一个错误,因为您正在调用没有参数的request。
https://stackoverflow.com/questions/21685892
复制相似问题