Created
April 7, 2016 20:39
-
-
Save quadrolls/9203f924f934398f6992162bbbcb1a0c to your computer and use it in GitHub Desktop.
Adding headers to a request in a controller spec in RSpec 3 and Rails 4
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::LoginsController, type: :controller do | |
before :each do | |
@header_code = 'AZSALE12345' | |
end | |
describe 'logout', focus: true do | |
it 'returns status 204' do | |
request.headers.merge!({'X-GROUP-CODE': @header_code}) | |
post :logout | |
expect(response.status).to eq(204) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment