Here is a nice answer if your are doing controller or acceptance tests.
If you're like me and went with Rack::Test::Methods (see this post section 'Testing your API', some examples here as well), here's the solution (which was a pain to figure out ...) :
ruby
get '/api/v1/users.json', nil, 'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Token.encode_credentials('THE-AWESOME-TOKEN')
Thank you for this :)
Here is a nice answer if your are doing controller or acceptance tests.
If you're like me and went with Rack::Test::Methods (see this post section 'Testing your API', some examples here as well), here's the solution (which was a pain to figure out ...) :
And here is a little helper to keep things DRY :