How do I mock an object in this case? no obvious way to replace object with mock
- by Tristan
Hi there,
Suppose I have this very simple method in Store's model:
def geocode_address
loc = Store.geocode(address)
self.lat = loc.lat
self.lng = loc.lng
end
If I want to write some test scripts that aren't affected by the geocoding service, which may be down, have limitations or depend on my internet connection, how do I mock out the geocoding service? If I could pass a geocoding object into the method, it would be easy, but I don't see how I could do it in this case.
Thanks!
Tristan