Sha256: 4eb9eca660bf74bbcc7b48593e9960313ec70b0c8047d58f3b6513ac93229e17

Contents?: true

Size: 592 Bytes

Versions: 4

Compression:

Stored size: 592 Bytes

Contents

require 'spec_helper'

describe Rack::OAuth2::AccessToken::Bearer do
  let :token do
    Rack::OAuth2::AccessToken::Bearer.new(
      :access_token => 'access_token'
    )
  end
  let(:resource_endpoint) { 'https://server.example.com/resources/fake' }
  let(:request) { HTTPClient.new.send(:create_request, :post, URI.parse(resource_endpoint), {}, {:hello => "world"}, {}) }

  describe '.authenticate' do
    it 'should set Authorization header' do
      expect(request.header).to receive(:[]=).with('Authorization', 'Bearer access_token')
      token.authenticate(request)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rack-oauth2-1.1.1 spec/rack/oauth2/access_token/bearer_spec.rb
rack-oauth2-1.1.0 spec/rack/oauth2/access_token/bearer_spec.rb
rack-oauth2-1.0.10 spec/rack/oauth2/access_token/bearer_spec.rb
rack-oauth2-1.0.9 spec/rack/oauth2/access_token/bearer_spec.rb