Sha256: 2512e8f9f329f09f594005d2f6adf184acb15a0475150579dfe25749a4dbac09

Contents?: true

Size: 828 Bytes

Versions: 19

Compression:

Stored size: 828 Bytes

Contents

require_relative '../test_helper'
require_relative '../../lib/faraday/connection'

module Faraday
  describe Connection do
    describe 'digest_auth' do
      let(:connection) do
        Faraday.new('http://api.example.org/') do |builder|
          builder.request :url_encoded
          builder.adapter :net_http
        end
      end

      it 'inserts the DigestAuth middleware at the top' do
        connection.digest_auth('user', 'password')

        connection.builder.handlers.first.klass.must_equal Faraday::Request::DigestAuth
      end

      it 'passes the user and password to the middleware' do
        connection.digest_auth('user', 'password')

        Faraday::Request::DigestAuth.expects(:new).with(anything, 'user', 'password').returns(stub_everything)

        connection.get('/')
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hyperclient-0.9.3 test/faraday/connection_test.rb
hyperclient-0.9.1 test/faraday/connection_test.rb
hyperclient-0.9.0 test/faraday/connection_test.rb
hyperclient-0.8.6 test/faraday/connection_test.rb
hyperclient-0.8.5 test/faraday/connection_test.rb
hyperclient-0.8.4 test/faraday/connection_test.rb
hyperclient-0.8.3 test/faraday/connection_test.rb
hyperclient-0.8.2 test/faraday/connection_test.rb
hyperclient-0.8.1 test/faraday/connection_test.rb
hyperclient-0.8.0 test/faraday/connection_test.rb
hyperclient-0.7.2 test/faraday/connection_test.rb
hyperclient-0.7.1 test/faraday/connection_test.rb
hyperclient-0.7.0 test/faraday/connection_test.rb
hyperclient-0.6.1 test/faraday/connection_test.rb
hyperclient-0.5.0 test/faraday/connection_test.rb
hyperclient-0.4.0 test/faraday/connection_test.rb
hyperclient-0.3.2 test/faraday/connection_test.rb
hyperclient-0.3.1 test/faraday/connection_test.rb
hyperclient-0.3.0 test/faraday/connection_test.rb