Sha256: c9a288ba20a7cf0c31422aa572b8a42b48dea39f30cf3b212fa8a9592bbe5183

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

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

class GeoPluginGeocoderTest < 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_geo_plugin_geocode
    VCR.use_cassette('geo_plugin_geocode') do
    url = "http://www.geoplugin.net/xml.gp?ip=#{@ip}"
    res = Geokit::Geocoders::GeoPluginGeocoder.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

2 entries across 2 versions & 1 rubygems

Version Path
geokit-1.8.1 test/test_geo_plugin_geocoder.rb
geokit-1.8.0 test/test_geo_plugin_geocoder.rb