Sha256: 0e5f01f0b3a410382ef71a9c3f6c0d269420dfe2469970e9854a32802fd3ad62

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

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' }

  [:get, :delete].each do |method|
    before do
      fake_response(method, resource_endpoint, 'resources/fake.txt')
    end

    describe method.to_s.upcase do
      it 'should have OAuth2 Authorization header' do
        RestClient.should_receive(method).with(
          resource_endpoint,
          :AUTHORIZATION => 'OAuth2 access_token'
        )
        token.send method, resource_endpoint
      end
    end
  end

  [:post, :put].each do |method|
    before do
      fake_response(method, resource_endpoint, 'resources/fake.txt')
    end

    describe method.to_s.upcase do
      it 'should have OAuth2 Authorization header' do
        RestClient.should_receive(method).with(
          resource_endpoint,
          {:key => :value},
          {:AUTHORIZATION => 'OAuth2 access_token'}
        )
        token.send method, resource_endpoint, {:key => :value}
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-oauth2-0.6.9 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.6.8 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.6.7 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.6.6 spec/rack/oauth2/access_token/legacy_spec.rb
rack-oauth2-0.6.5 spec/rack/oauth2/access_token/legacy_spec.rb