Sha256: 72cae6646b593f56498aaeeaacebbd173f7a669eec20872e08d30d83208b04a8

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

class FakeDriver < Webdrivers::Common
  def self.http_object
    self.http
  end
end

describe "Support for proxies" do
  let(:http_object) { FakeDriver.http_object }

  before do
    Webdrivers.proxy_addr = nil
    Webdrivers.proxy_port = nil
    Webdrivers.proxy_user = nil
    Webdrivers.proxy_pass = nil
  end

  it 'should allow the proxy values to be set via configuration' do
    Webdrivers.configure do |config|
      config.proxy_addr = 'proxy_addr'
      config.proxy_port = '8888'
      config.proxy_user = 'proxy_user'
      config.proxy_pass = 'proxy_pass'
    end

    expect(Webdrivers.proxy_addr).to eql 'proxy_addr'
    expect(Webdrivers.proxy_port).to eql '8888'
    expect(Webdrivers.proxy_user).to eql 'proxy_user'
    expect(Webdrivers.proxy_pass).to eql 'proxy_pass'
  end

  it 'should use the Proxy when the proxy_addr is set' do
    Webdrivers.configure do |config|
      config.proxy_addr = 'proxy_addr'
      config.proxy_port = '8080'
    end

    expect(http_object.instance_variable_get('@is_proxy_class')).to be true
  end

  it 'should not use the Proxy when proxy is not configured' do
    expect(http_object.instance_variable_get('@is_proxy_class')).to be false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webdrivers-3.7.0 spec/proxy_support_spec.rb