Sha256: bb7319f2bb60e5e85509baacf57fb9214c51f8bdc79bc4d3d2f434c949458bb3
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require 'test_helper' module Graticule module Geocoder class YahooTest < Test::Unit::TestCase def setup URI::HTTP.responses = [] URI::HTTP.uris = [] @geocoder = Yahoo.new 'APP_ID' @location = Location.new( :street => "701 1st Ave", :locality => "Sunnyvale", :region => "CA", :postal_code => "94089-1019", :country => "US", :longitude => -122.025055, :latitude => 37.416397, :precision => :address, :warning => "The exact location could not be found, here is the closest match: 701 First Ave, Sunnyvale, CA 94089" ) end def test_locate prepare_response(:success) assert_equal @location, @geocoder.locate('701 First Street, Sunnyvale, CA') end def test_url prepare_response(:success) @geocoder.locate('701 First Street, Sunnyvale, CA') assert_equal 'http://api.local.yahoo.com/MapsService/V1/geocode?appid=APP_ID&location=701%20First%20Street,%20Sunnyvale,%20CA&output=xml', URI::HTTP.uris.first end def test_locate_bad_address prepare_response(:unknown_address) assert_raise(Error) { @geocoder.locate('yucksthoeusthaoeusnhtaosu') } end protected def prepare_response(id) URI::HTTP.responses << response('yahoo', id) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graticule-1.0.0.pre2 | test/graticule/geocoder/yahoo_test.rb |
graticule-1.0.0.pre | test/graticule/geocoder/yahoo_test.rb |