Sha256: 9cd8ca0689589f1e471ca16685554f2bdf93db1c6fdeb6c73df14e1394f7df0f

Contents?: true

Size: 592 Bytes

Versions: 3

Compression:

Stored size: 592 Bytes

Contents

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

class IpApiGeocoderTest < BaseGeocoderTest #:nodoc: all
  def setup
    super
    @ip = '74.125.237.209'
  end

  def assert_url(expected_url)
    assert_equal expected_url, TestHelper.last_url
  end

  def test_free_geo_ip_geocode
    url = "http://ip-api.com/json/#{@ip}"
    res = geocode(@ip, :ip_api_geocode)
    assert_url url
    assert_equal res.city, 'Mountain View'
    assert_equal res.state, 'CA'
    assert_equal res.state_name, 'California'
    assert_equal res.zip, '94043'
    assert_equal res.country_code, 'US'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
geokit-1.13.1 test/test_ip_api_geocoder.rb
geokit-1.13.0 test/test_ip_api_geocoder.rb
geokit-1.12.0 test/test_ip_api_geocoder.rb