test/test_google_geocoder.rb in geokit-1.8.2 vs test/test_google_geocoder.rb in geokit-1.8.3

- old
+ new

@@ -28,14 +28,14 @@ # Example from: # https://developers.google.com/maps/documentation/business/webservices#signature_examples def test_google_signature_and_url Geokit::Geocoders::GoogleGeocoder.client_id = 'clientID' Geokit::Geocoders::GoogleGeocoder.cryptographic_key = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=' - url = Geokit::Geocoders::GoogleGeocoder.send(:submit_url, '/maps/api/geocode/json?address=New+York&sensor=false') + url = Geokit::Geocoders::GoogleGeocoder.send(:submit_url, 'address=New+York') Geokit::Geocoders::GoogleGeocoder.client_id = nil Geokit::Geocoders::GoogleGeocoder.cryptographic_key = nil - assert_equal 'http://maps.googleapis.com/maps/api/geocode/json?address=New+York&sensor=false&client=clientID&signature=KrU1TzVQM7Ur0i8i7K3huiw3MsA=', url + assert_equal 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=New+York&client=clientID&signature=9mevp7SoVsSKzF9nj-vApMYbatg=', url end def test_google_full_address VCR.use_cassette('google_full_short') do url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}" @@ -184,9 +184,20 @@ assert_equal "Community of Madrid", res.state assert_equal "Spain", res.country assert_equal "28013", res.zip assert_equal true, res.success + end + end + + def test_reverse_geocode_language + VCR.use_cassette('google_reverse_madrid_es') do + url = "http://maps.google.com/maps/api/geocode/json?sensor=false&latlng=40.416%2C-3.703&language=es" + TestHelper.expects(:last_url).with(url) + language_result = Geokit::Geocoders::GoogleGeocoder.reverse_geocode('40.416,-3.703', :language => 'es') + + assert_equal 'ES', language_result.country_code + assert_equal 'Madrid', language_result.city end end def test_country_code_biasing VCR.use_cassette('google_country_code_biased_result') do