Sha256: 190a4d9def1942e35fdaad74a21d2faf1e8e486c33d35e625babf116438c44e8

Contents?: true

Size: 1.64 KB

Versions: 38

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

RSpec.describe Faraday::Adapter::NetHttpPersistent do
  features :request_body_on_query_methods, :reason_phrase_parse, :compression, :trace_method

  it_behaves_like 'an adapter'

  it 'allows to provide adapter specific configs' do
    url = URI('https://example.com')

    adapter = described_class.new do |http|
      http.idle_timeout = 123
    end

    http = adapter.send(:connection, url: url, request: {})
    adapter.send(:configure_request, http, {})

    expect(http.idle_timeout).to eq(123)
  end

  it 'sets max_retries to 0' do
    url = URI('http://example.com')

    adapter = described_class.new

    http = adapter.send(:connection, url: url, request: {})
    adapter.send(:configure_request, http, {})

    # `max_retries=` is only present in Ruby 2.5
    expect(http.max_retries).to eq(0) if http.respond_to?(:max_retries=)
  end

  it 'allows to set pool_size on initialize' do
    url = URI('https://example.com')

    adapter = described_class.new(nil, pool_size: 5)

    http = adapter.send(:connection, url: url, request: {})

    # `pool` is only present in net_http_persistent >= 3.0
    expect(http.pool.size).to eq(5) if http.respond_to?(:pool)
  end

  context 'min_version' do
    it 'allows to set min_version in SSL settings' do
      url = URI('https://example.com')

      adapter = described_class.new(nil)

      http = adapter.send(:connection, url: url, request: {})
      adapter.send(:configure_ssl, http, min_version: :TLS1_2)

      # `min_version` is only present in net_http_persistent >= 3.1 (UNRELEASED)
      expect(http.min_version).to eq(:TLS1_2) if http.respond_to?(:min_version)
    end
  end
end

Version data entries

38 entries across 30 versions & 10 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/faraday-1.2.0/spec/faraday/adapter/net_http_persistent_spec.rb
alloy_sdk-0.1.0 vendor/bundle/ruby/3.0.0/gems/faraday-1.0.1/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/faraday-1.2.0/spec/faraday/adapter/net_http_persistent_spec.rb
faraday-1.3.1 spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/faraday-1.2.0/spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/faraday-1.3.0/spec/faraday/adapter/net_http_persistent_spec.rb
faraday-1.3.0 spec/faraday/adapter/net_http_persistent_spec.rb
faraday-1.2.0 spec/faraday/adapter/net_http_persistent_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/adapter/net_http_persistent_spec.rb
faraday-1.1.0 spec/faraday/adapter/net_http_persistent_spec.rb