Created
February 27, 2020 10:46
-
-
Save diraulo/e02d9a7a14c2c3e1f65cdb33e2770e52 to your computer and use it in GitHub Desktop.
Sample GET request spec with custom headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe Api::V1::ProductsController, type: :request do | |
describe 'GET#index' do | |
it 'list all products' do | |
# you can add more headers in that hash | |
headers = { | |
'ACCEPT' => 'application/json', | |
'CONTENT_TYPE' => 'application/json', | |
} | |
# Setup specs, create data | |
get '/api/v1/products', params: nil, headers: headers, as: :json | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment