Sha256: faec3a427afbf4d187b13c3a828b489187628cd00d74b16c7b3b4e8c725ec7ed

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

require 'spec_helper_integration'

describe Doorkeeper::TokensController do
  describe 'when authorization has succeeded' do
    let :token do
      double(:token, authorize: true)
    end

    before do
      allow(controller).to receive(:token) { token }
    end

    it 'returns the authorization' do
      skip 'verify need of these specs'
      expect(token).to receive(:authorization)
      post :create
    end
  end

  describe 'when authorization has failed' do
    let :token do
      double(:token, authorize: false)
    end

    before do
      allow(controller).to receive(:token) { token }
    end

    it 'returns the error response' do
      skip 'verify need of these specs'
      allow(token).to receive(:error_response).and_return(double(to_json: [], status: :unauthorized))
      post :create
      expect(response.status).to eq 401
      expect(response.headers['WWW-Authenticate']).to match(/Bearer/)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
doorkeeper-1.4.2 spec/controllers/tokens_controller_spec.rb
doorkeeper-1.4.1 spec/controllers/tokens_controller_spec.rb
doorkeeper-2.0.0.alpha1 spec/controllers/tokens_controller_spec.rb
doorkeeper-1.4.0 spec/controllers/tokens_controller_spec.rb
doorkeeper-1.3.1 spec/controllers/tokens_controller_spec.rb