Sha256: 7e3fc26c1fba465e3af6297fe2aae30be414f7d00b33f29be637adcba85c901d
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require 'rails_helper' RSpec.describe 'OAuth bearer token requests', type: :request do let(:request_path) { '/example.json' } context 'with valid access token' do with :access_token let(:headers) do { 'Authorization' => "Bearer #{access_token.token}" } end let(:params) { {} } before do get request_path, params, headers end it { expect(response.status).to eq 200 } end context 'with expired access token' do with :access_token, expires_in: 0 let(:headers) do { 'Authorization' => "Bearer #{access_token.token}" } end let(:params) { {} } before do get request_path, params, headers end it { expect(response.status).to eq 401 } end context 'with revoked access token' do with :access_token, revoked_at: 1.year.ago let(:headers) do { 'Authorization' => "Bearer #{access_token.token}" } end let(:params) { {} } before do get request_path, params, headers end it { expect(response.status).to eq 401 } end context 'with invalid access token' do let(:access_token) { double(:fake_token, token: 'invalid') } let(:headers) do { 'Authorization' => "Bearer #{access_token.token}" } end let(:params) { {} } before do get request_path, params, headers end it { expect(response.status).to eq 401 } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise-doorkeeper-1.0.0 | spec/requests/oauth/bearer_tokens_spec.rb |