Sha256: 4fc0ca353e42db95edecc16bef8d49b1a5ebc09cd91c52e4632d514de65498de

Contents?: true

Size: 1.21 KB

Versions: 41

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

RSpec.describe Faraday::ProxyOptions do
  describe '#from' do
    it 'works with string' do
      options = Faraday::ProxyOptions.from 'http://user:pass@example.org'
      expect(options.user).to eq('user')
      expect(options.password).to eq('pass')
      expect(options.uri).to be_a_kind_of(URI)
      expect(options.path).to eq('')
      expect(options.port).to eq(80)
      expect(options.host).to eq('example.org')
      expect(options.scheme).to eq('http')
      expect(options.inspect).to match('#<Faraday::ProxyOptions uri=')
    end

    it 'works with nil' do
      options = Faraday::ProxyOptions.from nil
      expect(options).to be_a_kind_of(Faraday::ProxyOptions)
      expect(options.inspect).to eq('#<Faraday::ProxyOptions (empty)>')
    end

    it 'works with no auth' do
      proxy = Faraday::ProxyOptions.from 'http://example.org'
      expect(proxy.user).to be_nil
      expect(proxy.password).to be_nil
    end
  end

  it 'allows hash access' do
    proxy = Faraday::ProxyOptions.from 'http://a%40b:pw%20d@example.org'
    expect(proxy.user).to eq('a@b')
    expect(proxy[:user]).to eq('a@b')
    expect(proxy.password).to eq('pw d')
    expect(proxy[:password]).to eq('pw d')
  end
end

Version data entries

41 entries across 33 versions & 11 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/faraday-1.2.0/spec/faraday/options/proxy_options_spec.rb
alloy_sdk-0.1.0 vendor/bundle/ruby/3.0.0/gems/faraday-1.0.1/spec/faraday/options/proxy_options_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/options/proxy_options_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/options/proxy_options_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/options/proxy_options_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/options/proxy_options_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/options/proxy_options_spec.rb
cocRb-0.1.0 .bundle/ruby/3.0.0/gems/faraday-1.4.1/spec/faraday/options/proxy_options_spec.rb
faraday-1.4.1 spec/faraday/options/proxy_options_spec.rb
faraday-1.4.0 spec/faraday/options/proxy_options_spec.rb
faraday-1.3.1 spec/faraday/options/proxy_options_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/faraday-1.1.0/spec/faraday/options/proxy_options_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/spec/faraday/options/proxy_options_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/options/proxy_options_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/faraday-1.2.0/spec/faraday/options/proxy_options_spec.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/faraday-1.3.0/spec/faraday/options/proxy_options_spec.rb
faraday-1.3.0 spec/faraday/options/proxy_options_spec.rb
faraday-1.2.0 spec/faraday/options/proxy_options_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/options/proxy_options_spec.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/faraday-1.1.0/spec/faraday/options/proxy_options_spec.rb