Sha256: a7f55b7d77426c58e8d59c22098890a0865b7c810f8d3dff3915009ea5f2d9cf

Contents?: true

Size: 1.07 KB

Versions: 24

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe FbGraph2::RequestFilter::Authenticator do
  let(:klass)    { FbGraph2::RequestFilter::Authenticator }

  let(:endpoint) { 'https://graph.facebook.com/matake' }
  let(:request)  { HTTP::Message.new_request(:get, URI.parse(endpoint)) }
  let(:request_filter) { klass.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

24 entries across 24 versions & 1 rubygems

Version Path
fb_graph2-0.7.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.7.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.6.2 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.6.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.6.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.5.3 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.5.2 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.5.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.5.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.4.4 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.4.3 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.4.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.4.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.3.2 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.3.1 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.3.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.2.0 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.1.3 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.1.2 spec/fb_graph2/request_filter/authenticator_spec.rb
fb_graph2-0.1.1 spec/fb_graph2/request_filter/authenticator_spec.rb