Sha256: 8ab9f69cced7a01d1ea3ec9eeb31dde3720c71faddd12254c80ef0c0dd61db78

Contents?: true

Size: 670 Bytes

Versions: 6

Compression:

Stored size: 670 Bytes

Contents

require 'spec_helper'

describe Rack::OAuth2::AccessToken::Legacy do
  let :token do
    Rack::OAuth2::AccessToken::Legacy.new(
      access_token: 'access_token'
    )
  end
  let(:resource_endpoint) { 'https://server.example.com/resources/fake' }
  let(:request) { Faraday::Request.new(:post, URI.parse(resource_endpoint), '', {hello: "world"}, {}) }

  describe '#to_s' do
    subject { token }
    its(:to_s) { should == token.access_token }
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rack-oauth2-2.1.0 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-2.0.1 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-2.0.0 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-2.0.0.rc3 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-2.0.0.rc2 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-2.0.0.rc1 spec/rack/oauth2/access_token/legacy_spec.rb