Sha256: 77f4075baa28fe8035fbf2c0c8c83ed76530c90f56b302c3ab814f80ad97886a

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8
$: << File.join(File.dirname(__FILE__), "..")
require 'test_helper'

class ProxyTest < GeocoderTestCase

  def test_uses_proxy_when_specified
    Geocoder.configure(:http_proxy => 'localhost')
    lookup = Geocoder::Lookup::Google.new
    assert lookup.send(:http_client).proxy_class?
  end

  def test_doesnt_use_proxy_when_not_specified
    lookup = Geocoder::Lookup::Google.new
    assert !lookup.send(:http_client).proxy_class?
  end

  def test_exception_raised_on_bad_proxy_url
    Geocoder.configure(:http_proxy => ' \\_O< Quack Quack')
    assert_raise Geocoder::ConfigurationError do
      Geocoder::Lookup::Google.new.send(:http_client)
    end
  end

  def test_accepts_proxy_with_http_protocol
    Geocoder.configure(:http_proxy => 'http://localhost')
    lookup = Geocoder::Lookup::Google.new
    assert lookup.send(:http_client).proxy_class?
  end

  def test_accepts_proxy_with_https_protocol
    Geocoder.configure(:https_proxy => 'https://localhost')
    Geocoder.configure(:use_https => true)
    lookup = Geocoder::Lookup::Google.new
    assert lookup.send(:http_client).proxy_class?
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
geocoder-1.2.7 test/unit/proxy_test.rb
geocoder-kb-1.2.6 test/unit/proxy_test.rb
geocoder-1.2.6 test/unit/proxy_test.rb
bw-geocoder-1.2.6 test/unit/proxy_test.rb
bw-geocoder-1.2.5 test/unit/proxy_test.rb
geocoder-1.2.5 test/unit/proxy_test.rb
geocoder-1.2.4 test/unit/proxy_test.rb
geocoder-1.2.3 test/unit/proxy_test.rb
geocoder-1.2.2 test/unit/proxy_test.rb
geocoder-1.2.1 test/unit/proxy_test.rb
geocoder-1.2.0 test/unit/proxy_test.rb