Sha256: 07178fb6bf9615cf87ee11c439616936408c06ed9a92ebe7a7763054bcd06b00

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

require File.join(File.dirname(__FILE__), "helper")

class FreeGeoIpGeocoderTest < BaseGeocoderTest #:nodoc: all
  def setup
    super
    @ip = "74.125.237.209"
  end

  def assert_url(expected_url)
    assert_equal expected_url, TestHelper.get_last_url.gsub(/&oauth_[a-z_]+=[a-zA-Z0-9\-. %]+/, "").gsub("%20", "+")
  end

  def test_free_geo_ip_geocode
    VCR.use_cassette("free_geo_ip_geocode") do
      url = "http://freegeoip.net/xml/#{@ip}"
    res = Geokit::Geocoders::FreeGeoIpGeocoder.geocode(@ip)
    assert_url url
    assert_equal res.city, "Mountain View"
    assert_equal res.state, "CA"
    assert_equal res.country_code, "US"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geokit-1.10.0 test/test_free_geo_ip_geocoder.rb