Sha256: d74309c4d1f5b5bd5c5b2faa5eb588315dfab403adb107cfc41d6f29eef64244

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require 'spec_helper'

describe Rack::OAuth2::AccessToken::Authenticator do
  let(:resource_endpoint) { 'https://server.example.com/resources/fake' }
  let(:request) { Faraday::Request.new(:get, URI.parse(resource_endpoint)) }
  let(:authenticator) { Rack::OAuth2::AccessToken::Authenticator.new(token) }

  shared_examples_for :authenticator do
    it 'should let the token authenticate the request' do
      expect(token).to receive(:authenticate).with(request)
      authenticator.authenticate(request)
    end
  end

  context 'when Bearer token is given' do
    let(:token) do
      Rack::OAuth2::AccessToken::Bearer.new(
        access_token: 'access_token'
      )
    end
    it_behaves_like :authenticator
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-oauth2-2.2.1 spec/rack/oauth2/access_token/authenticator_spec.rb
rack-oauth2-2.2.0 spec/rack/oauth2/access_token/authenticator_spec.rb