Sha256: 6db8807ea952b399af03912045be9049de7db7cd96c8c4b09ee87141506faa88

Contents?: true

Size: 687 Bytes

Versions: 7

Compression:

Stored size: 687 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) { HTTPClient.new.send(:create_request, :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
      request.header.should_receive(:[]=).with('Authorization', 'OAuth2 access_token')
      token.authenticate(request)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rack-oauth2-0.8.5 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.8.4 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.8.3 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.8.2 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.8.1 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.8.0 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.8.0.alpha spec/rack/oauth2/access_token/legacy_spec.rb