Sha256: 84b6433855d9d213bf363feff1140390006eddb1cef94844babbf91a5d955ddc

Contents?: true

Size: 1.49 KB

Versions: 47

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

RSpec.describe Faraday::Adapter::EMHttp, unless: defined?(JRUBY_VERSION) do
  features :request_body_on_query_methods, :reason_phrase_parse, :trace_method,
           :skip_response_body_on_head, :parallel, :local_socket_binding

  it_behaves_like 'an adapter'

  it 'allows to provide adapter specific configs' do
    url = URI('https://example.com:1234')
    adapter = described_class.new nil, inactivity_timeout: 20
    req = adapter.create_request(url: url, request: {})

    expect(req.connopts.inactivity_timeout).to eq(20)
  end

  context 'Options' do
    let(:request) { Faraday::RequestOptions.new }
    let(:env) { { request: request } }
    let(:options) { {} }
    let(:adapter) { Faraday::Adapter::EMHttp.new }

    it 'configures timeout' do
      request.timeout = 5
      adapter.configure_timeout(options, env)
      expect(options[:inactivity_timeout]).to eq(5)
      expect(options[:connect_timeout]).to eq(5)
    end

    it 'configures timeout and open_timeout' do
      request.timeout = 5
      request.open_timeout = 1
      adapter.configure_timeout(options, env)
      expect(options[:inactivity_timeout]).to eq(5)
      expect(options[:connect_timeout]).to eq(1)
    end

    it 'configures all timeout settings' do
      request.timeout = 5
      request.read_timeout = 3
      request.open_timeout = 1
      adapter.configure_timeout(options, env)
      expect(options[:inactivity_timeout]).to eq(3)
      expect(options[:connect_timeout]).to eq(1)
    end
  end
end

Version data entries

47 entries across 37 versions & 11 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/faraday-1.2.0/spec/faraday/adapter/em_http_spec.rb
alloy_sdk-0.1.0 vendor/bundle/ruby/3.0.0/gems/faraday-1.0.1/spec/faraday/adapter/em_http_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.4.2/spec/faraday/adapter/em_http_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/faraday-1.4.2/spec/faraday/adapter/em_http_spec.rb
faraday-1.5.0 spec/faraday/adapter/em_http_spec.rb
faraday-1.4.3 spec/faraday/adapter/em_http_spec.rb
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.4.2/spec/faraday/adapter/em_http_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/em_http_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/em_http_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/faraday-1.4.2/spec/faraday/adapter/em_http_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/em_http_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/faraday-1.4.2/spec/faraday/adapter/em_http_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/adapter/em_http_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/em_http_spec.rb
faraday-1.4.2 spec/faraday/adapter/em_http_spec.rb
cocRb-0.1.0 .bundle/ruby/3.0.0/gems/faraday-1.4.1/spec/faraday/adapter/em_http_spec.rb
faraday-1.4.1 spec/faraday/adapter/em_http_spec.rb
faraday-1.4.0 spec/faraday/adapter/em_http_spec.rb
faraday-1.3.1 spec/faraday/adapter/em_http_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/adapter/em_http_spec.rb