I'm building a REST API on Rails, and I'm trying to use RSpec to test it. I'm using fairly boilerplate auth code:
  def authenticate_user_from_token
    pp 'authenticate_user_from_token'
    pp request.headers.inspect
    user = authenticate_with_http_token do |token, options|
      pp token
      user_id = options[:user_id]
      user = user_id && Eater.find_by_id(user_id)
      if user && Devise.secure_compare(user.auth_token, token)
        user
      else
        nil
      end
    end
    @current_user = user
  end
This works perfectly if I send requests with curl, but I can't figure out how to pass the auth token in Rspec. My basic request is this:
get '/api/1/users/1'
I've tried setting the token using the header method:
header 'Authorization: Token token', @token
That doesn't work. I've also tried passing it to the get method as I've seen in some examples:
get '/api/1/users/1', :authorization => @token
Also doesn't work. What's the correct way to do this?

