Sha256: 2fdcdd47024f865ecb6a1c98229b826bf3ed9afc6ca29b406ab72ea578a61683

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

require 'weary/middleware/oauth'
require 'spec_helper'

describe Weary::Middleware::OAuth do
  describe "#call" do
    before do
      @url = "http://github.com/api/v2/json/repos/show/mwunsch/weary"
      @request = Weary::Request.new @url
      stub_request :get, @request.uri.to_s
    end

    it_behaves_like "a Rack application" do
      subject { described_class.new(@request, "consumer_key", "access_token") }
      let(:env) { @request.env }
    end

    it "prepares the Authorization header for the request" do
      middleware = described_class.new(@request, "consumer_key", "access_token")
      middleware.call(@request.env)
      signed_header = middleware.sign(@request.env)
      a_request(:get, @url).
        with {|req| req.headers.has_key?("Authorization") }.
        should have_been_made
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weary-1.0.0.rc1 spec/weary/middleware/oauth_spec.rb