Sha256: 548fba7dfd7502cc88e051702722c4555c2be252fa412d05fad4236f523263d0

Contents?: true

Size: 1.11 KB

Versions: 142

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

RSpec.describe Faraday::Adapter do
  let(:adapter) { Faraday::Adapter.new }
  let(:request) { {} }

  context '#request_timeout' do
    it 'gets :read timeout' do
      expect(timeout(:read)).to eq(nil)

      request[:timeout] = 5
      request[:write_timeout] = 1

      expect(timeout(:read)).to eq(5)

      request[:read_timeout] = 2

      expect(timeout(:read)).to eq(2)
    end

    it 'gets :open timeout' do
      expect(timeout(:open)).to eq(nil)

      request[:timeout] = 5
      request[:write_timeout] = 1

      expect(timeout(:open)).to eq(5)

      request[:open_timeout] = 2

      expect(timeout(:open)).to eq(2)
    end

    it 'gets :write timeout' do
      expect(timeout(:write)).to eq(nil)

      request[:timeout] = 5
      request[:read_timeout] = 1

      expect(timeout(:write)).to eq(5)

      request[:write_timeout] = 2

      expect(timeout(:write)).to eq(2)
    end

    it 'attempts unknown timeout type' do
      expect { timeout(:unknown) }.to raise_error(ArgumentError)
    end

    def timeout(type)
      adapter.send(:request_timeout, type, request)
    end
  end
end

Version data entries

142 entries across 129 versions & 19 rubygems

Version Path
es_cli-0.1.0 vendor/bundle/ruby/3.1.0/gems/faraday-2.12.2/spec/faraday/adapter_spec.rb
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/faraday-1.10.4/spec/faraday/adapter_spec.rb
avalara_sdk-24.12.1 vendor/bundle/ruby/2.7.0/gems/faraday-1.10.4/spec/faraday/adapter_spec.rb
avalara_sdk-24.12.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.10.4/spec/faraday/adapter_spec.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/faraday-1.10.3/spec/faraday/adapter_spec.rb
faraday-2.12.2 spec/faraday/adapter_spec.rb
faraday-2.12.1 spec/faraday/adapter_spec.rb
moneykit-0.1.15 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_spec.rb
moneykit-0.1.14 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_spec.rb
faraday-1.10.4 spec/faraday/adapter_spec.rb
faraday-2.12.0 spec/faraday/adapter_spec.rb
faraday-2.11.0 spec/faraday/adapter_spec.rb
moneykit-0.1.13 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_spec.rb
moneykit-0.1.12 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_spec.rb
moneykit-0.1.11 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_spec.rb
faraday-2.10.1 spec/faraday/adapter_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/faraday-1.2.0/spec/faraday/adapter_spec.rb
faraday-2.10.0 spec/faraday/adapter_spec.rb
faraday-2.9.2 spec/faraday/adapter_spec.rb
faraday-2.9.1 spec/faraday/adapter_spec.rb