Sha256: bdaf4dd15d2cc45f250231ffb6fafaf8f1dbf23c55ef9f4f5d4c086351878740

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

require File.join(File.dirname(__FILE__), "helper")
class GeobytesGeocoderTest < BaseGeocoderTest #:nodoc: all
  def setup
    super
    @ip = "12.12.12.12"
  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_geobytes_geocoder
    VCR.use_cassette("geobytes_geocode") do
      url = "http://getcitydetails.geobytes.com/GetCityDetails?fqcn=#{@ip}"
      res = Geokit::Geocoders::GeobytesGeocoder.geocode(@ip)
      assert_url url
      assert_equal res.city, "New York"
      assert_equal res.state, "NY"
      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_geobytes_geocoder.rb