Sha256: e646cd173b2f17824d7115e9ea9381d5e759fae107bea0e4f4e195fec726f449
Contents?: true
Size: 1011 Bytes
Versions: 11
Compression:
Stored size: 1011 Bytes
Contents
# encoding: utf-8 $: << File.join(File.dirname(__FILE__), "..", "..") require 'test_helper' class NominatimTest < GeocoderTestCase def setup Geocoder.configure(lookup: :nominatim) set_api_key!(:nominatim) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "10001", result.postal_code assert_equal "Madison Square Garden, West 31st Street, Long Island City, New York City, New York, 10001, United States of America", result.address end def test_host_configuration Geocoder.configure(nominatim: {host: "local.com"}) query = Geocoder::Query.new("Bluffton, SC") assert_match %r(http://local\.com), query.url end def test_raises_exception_when_over_query_limit Geocoder.configure(:always_raise => [Geocoder::OverQueryLimitError]) l = Geocoder::Lookup.get(:nominatim) assert_raises Geocoder::OverQueryLimitError do l.send(:results, Geocoder::Query.new("over limit")) end end end
Version data entries
11 entries across 11 versions & 3 rubygems