test/test_bing_geocoder.rb in geokit-1.8.0 vs test/test_bing_geocoder.rb in geokit-1.8.1
- old
+ new
@@ -1,8 +1,8 @@
require File.join(File.dirname(__FILE__), 'helper')
-Geokit::Geocoders::bing = 'AuWcmtBIoPeOubm9BtcN44hTmWw_wNoJ5NEO2L0RaKrGAUE_nlwciKAqwapdq7k7'
+Geokit::Geocoders::BingGeocoder.key = 'AuWcmtBIoPeOubm9BtcN44hTmWw_wNoJ5NEO2L0RaKrGAUE_nlwciKAqwapdq7k7'
class BingGeocoderTest < BaseGeocoderTest #:nodoc: all
def setup
super
@@ -13,11 +13,12 @@
end
# the testing methods themselves
def test_bing_full_address
VCR.use_cassette('bing_full') do
- url = "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(@full_address)}?key=#{Geokit::Geocoders::bing}&o=xml"
+ key = Geokit::Geocoders::BingGeocoder.key
+ url = "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(@full_address)}?key=#{key}&o=xml"
res = Geokit::Geocoders::BingGeocoder.geocode(@full_address)
assert_equal "CA", res.state
assert_equal "San Francisco", res.city
assert_array_in_delta [37.792332, -122.393791], res.to_a
assert res.country == 'United States'
@@ -28,11 +29,12 @@
end
def test_bing_full_address_au
address = '440 King William Street, Adelaide, Australia'
VCR.use_cassette('bing_full_au') do
- url = "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(address)}?key=#{Geokit::Geocoders::bing}&o=xml"
+ key = Geokit::Geocoders::BingGeocoder.key
+ url = "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(address)}?key=#{key}&o=xml"
res = Geokit::Geocoders::BingGeocoder.geocode(address)
assert_equal "SA", res.state
assert_equal "Adelaide", res.city
assert_array_in_delta [-34.934582, 138.600784], res.to_a
assert res.country == 'Australia'
@@ -44,10 +46,11 @@
end
def test_bing_full_address_de
address = "Platz der Republik 1, 11011 Berlin, Germany"
VCR.use_cassette('bing_full_de') do
- url = "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(address)}?key=#{Geokit::Geocoders::bing}&o=xml"
+ key = Geokit::Geocoders::BingGeocoder.key
+ url = "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(address)}?key=#{key}&o=xml"
res = Geokit::Geocoders::BingGeocoder.geocode(address)
assert_equal "BE", res.state
assert_equal "Berlin", res.city
assert_array_in_delta [52.518596, 13.375502], res.to_a
assert res.country == 'Germany'