Sonntag, September 21, 2008

620 Errors while testing with Google Geocoding

If you are using Googles Geocoding Api you might experience occasional problems with 620 errors, especially while testing. The reason for this is Google prohibits too many calls in a short period. But for most testcases geocoding is not an issue so you should disable it for these.

Fortunatly in Ruby its easy to override existing methods to mock them. I use the geokit plugin and with it this could be done by the following method:

def disable_geocoding
GeoKit::Geocoders::Geocoder.instance_eval do
def geocode(a)
res = = 13.423007
res.lng = 52.534194
res.success = true

Include this in your testhelper and call disable_geocoding in your setup method.