require File.join(File.dirname(__FILE__), 'test_base_geocoder') Geokit::Geocoders::google = 'Google' class GoogleReverseGeocoderTest < BaseGeocoderTest #:nodoc: all GOOGLE_REVERSE_FULL=<<-EOF.strip 51.457833,7.016685200geocode
Porscheplatz 1, 45127 Essen, Deutschland
DEDeutschlandNordrhein-WestfalenEssenEssenStadtkernPorscheplatz 1451277.0166848,51.4578329,0
Stadtkern, Essen, Deutschland
DEDeutschlandNordrhein-WestfalenEssenEssenStadtkern7.0124328,51.4568201,0
45127 Essen, Deutschland
DEDeutschlandNordrhein-WestfalenEssenEssen451277.0104543,51.4556194,0
Essen, Deutschland
DEDeutschlandNordrhein-WestfalenEssenEssen7.0147614,51.4580686,0
Essen, Deutschland
DEDeutschlandNordrhein-WestfalenEssen7.0461136,51.4508381,0
Nordrhein-Westfalen, Deutschland
DEDeutschlandNordrhein-Westfalen7.6615938,51.4332367,0
Deutschland
DEDeutschland10.4515260,51.1656910,0
EOF def test_google_full_address response = MockSuccess.new response.expects(:body).returns(GOOGLE_REVERSE_FULL) # http://maps.google.com/maps/geo?output=xml&oe=utf-8&ll=51.4578329,7.0166848&key=asdad # # # @latlng = "51.4578329,7.0166848" url = "http://maps.google.com/maps/geo?ll=#{Geokit::Inflector.url_escape(@latlng)}&output=xml&key=Google&oe=utf-8" Geokit::Geocoders::GoogleGeocoder.expects(:call_geocoder_service).with(url).returns(response) res=Geokit::Geocoders::GoogleGeocoder.reverse_geocode(@latlng) assert_equal "Nordrhein-Westfalen", res.state assert_equal "Essen", res.city assert_equal "45127", res.zip assert_equal "51.4578329,7.0166848", res.ll # slightly dif from yahoo assert res.is_us? == false assert_equal "Porscheplatz 1, 45127 Essen, Deutschland", res.full_address #slightly different from yahoo assert_equal "google", res.provider end end