Sha256: 984cee6b14fc07b3a56bc0eeaeaa6a7d318c1badd27bbf5d3794cc4006f885f6

Contents?: true

Size: 659 Bytes

Versions: 6

Compression:

Stored size: 659 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

6 entries across 6 versions & 1 rubygems

Version Path
geokit-1.8.5 test/test_free_geo_ip_geocoder.rb
geokit-1.8.4 test/test_free_geo_ip_geocoder.rb
geokit-1.8.3 test/test_free_geo_ip_geocoder.rb
geokit-1.8.2 test/test_free_geo_ip_geocoder.rb
geokit-1.8.1 test/test_free_geo_ip_geocoder.rb
geokit-1.8.0 test/test_free_geo_ip_geocoder.rb