Sha256: 294e79a0d13a69fdea6195c376604b339c87214d01e37be5d9d1c0b2bc2b6f23

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe FbGraph2::RequestFilter::Authenticator do
  let(:endpoint) { 'https://graph.facebook.com/matake' }
  let(:request)  { HTTP::Message.new_request(:get, URI.parse(endpoint)) }
  let(:request_filter) { described_class.new token }

  context 'when String given' do
    let(:token) { 'token' }
    it do
      request_filter.filter_request(request)
      request.header["Authorization"].should == ["Bearer #{token}"]
    end
  end

  context 'when Rack::OAuth2::AccessToken::Bearer given' do
    let(:token) { Rack::OAuth2::AccessToken::Bearer.new access_token: 'token' }
    it do
      request_filter.filter_request(request)
      request.header["Authorization"].should == ["Bearer #{token.access_token}"]
    end
  end

  context 'when Rack::OAuth2::AccessToken::Legacy given' do
    let(:token) { Rack::OAuth2::AccessToken::Legacy.new access_token: 'token' }
    it do
      request_filter.filter_request(request)
      request.header["Authorization"].should == ["OAuth #{token.access_token}"]
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
fb_graph2-1.3.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-1.2.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-1.1.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-1.1.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-1.0.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-1.0.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.9.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.9.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.8.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.9 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.8 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.7 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.6 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.5 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.4 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.3 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.2 spec/fb_graph2/request_filter/authenticator_spec.rb