require 'rails_helper'
RSpec.describe "User management", :type => :request do
describe "PeopleGoal::V2::Users" do
describe "GET /api/v2/users/" do
it 'returns status 200, authorized' do
@token = "Bearer 123"
@url = "https://api.peoplegoal-v2.com/v2/users/me"
@headers = { "AUTHORIZATION" => @token}
get @url, as: :json, headers: {:Authorization => @token}
expect(response.status).to eq 200
end
end
end
end
I am trying to pass the @token
but I am getting this error
Failure/Error: get @url, as: :json, headers: {:Authorization => @token}
TypeError: no implicit conversion of nil into String
I can make a get request without the params and headers and it works but as soon as I add params or headers I get the error, I even tried writing it like so
1 - get @url, {}, { Authorization: @token}
ArgumentError: wrong number of arguments (given 2, expected 1)
2 - get @url, params: {}, headers: { Authorization: @token}
TypeError: no implicit conversion of nil into String
Some smart people please point me in the right direction =).
Gems:
gem 'rspec-rails', '~> 3.8'
gem 'rails', '~> 6.0.2.2'
Aucun commentaire:
Enregistrer un commentaire