Sha256: 156f17069f7c53657ca304d041e08fc2fbd831d7ef4fbeff4680fa7e10ad9089

Contents?: true

Size: 1.46 KB

Versions: 79

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

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

  it_behaves_like 'an adapter'

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

    adapter = described_class.new(nil, debug_request: true)

    conn = adapter.build_connection(url: url)

    expect(conn.data[:debug_request]).to be_truthy
  end

  context 'config' do
    let(:adapter) { Faraday::Adapter::Excon.new }
    let(:request) { Faraday::RequestOptions.new }
    let(:uri) { URI.parse('https://example.com') }
    let(:env) { { request: request, url: uri } }

    it 'sets timeout' do
      request.timeout = 5
      options = adapter.send(:opts_from_env, env)
      expect(options[:read_timeout]).to eq(5)
      expect(options[:write_timeout]).to eq(5)
      expect(options[:connect_timeout]).to eq(5)
    end

    it 'sets timeout and open_timeout' do
      request.timeout = 5
      request.open_timeout = 3
      options = adapter.send(:opts_from_env, env)
      expect(options[:read_timeout]).to eq(5)
      expect(options[:write_timeout]).to eq(5)
      expect(options[:connect_timeout]).to eq(3)
    end

    it 'sets open_timeout' do
      request.open_timeout = 3
      options = adapter.send(:opts_from_env, env)
      expect(options[:read_timeout]).to eq(nil)
      expect(options[:write_timeout]).to eq(nil)
      expect(options[:connect_timeout]).to eq(3)
    end
  end
end

Version data entries

79 entries across 66 versions & 15 rubygems

Version Path
faraday-1.1.0 spec/faraday/adapter/excon_spec.rb
passbase-1.0.2 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
passbase-1.0.1 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
passbase-1.0.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/faraday-1.0.1/spec/faraday/adapter/excon_spec.rb
faraday-1.0.1 spec/faraday/adapter/excon_spec.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/faraday-1.0.0/spec/faraday/adapter/excon_spec.rb
faraday-1.0.0 spec/faraday/adapter/excon_spec.rb