Sha256: 7055098c975afdb73411cf20281dc813719bd2e21450aae6876d26d2eccac19c

Contents?: true

Size: 695 Bytes

Versions: 6

Compression:

Stored size: 695 Bytes

Contents

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

class GeonamesGeocoderTest < BaseGeocoderTest #:nodoc: all
  def setup
    super
    @city = 'Adelaide'
  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_geonames_geocode
    VCR.use_cassette('geonames_geocode') do
    url = "http://ws.geonames.org/postalCodeSearch?placename=#{@city}&maxRows=10"
    res = Geokit::Geocoders::GeonamesGeocoder.geocode(@city)
    assert_url url
    assert_equal res.country_code, 'AU'
    assert_equal res.state, 'South Australia'
    assert_equal res.city, 'Adelaide'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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