This is my code:
before(:each) do
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials(api_key.access_token)
end
My test was supposed to pass but it is displaying this error:
Failure/Error: request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials("#{api_key.access_token}")
ArgumentError:
wrong number of arguments (0 for 1..2)
Gems:
rspec-rails version = 2.14.1.
rails verison = 4
mongoid from 'git://github.com/mongoid/mongoid.git'
The request method you are accessing in your test is documented at http://rubydoc.info/gems/rack-test/0.6.2/Rack/Test/Session:request and expects 1 or 2 arguments as the error indicates. You're getting an error on request.env because you're invoking request with no arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With