Sha256: 2a5e2ff53c26a339681f25a71f324c08aac0cfa4022dd4298622a81f16cdaa43

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

require 'weary/middleware/basic_auth'
require 'spec_helper'

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

    it_behaves_like "a Rack application" do
      subject { described_class.new(@request, ["mwunsch", "secret"]) }
      let(:env) { @request.env }
    end

    it "prepares the Authorization header for the request" do
      middleware = described_class.new(@request, ["mwunsch", "secret"])
      middleware.call(@request.env)
      a_request(:get, @url).should have_been_made
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
weary-1.0.1 spec/weary/middleware/basic_auth_spec.rb
weary-1.0.0 spec/weary/middleware/basic_auth_spec.rb
weary-1.0.0.rc1 spec/weary/middleware/basic_auth_spec.rb