johnkferguson / octomaps

Octomaps displays all contributors to an open-source project on a map based upon the contributor's location.
http://octomaps.com/
MIT License
15 stars 3 forks source link

Build randomly fails because of location-based lookups #31

Closed dblock closed 10 years ago

dblock commented 10 years ago

This build failed because of location lookups against a real service. I think sometimes they return results and sometimes they run into some kind of error (like quota or whatever).

Should be recorded via VCR for tests.

johnkferguson commented 10 years ago

This commit and this commit fix the issue.

I wrote all of the original tests a while back when I didn't really understand mocking or stubbing. As a consequence, any time I saved a Location object, it triggered a geocode callback to Google.

So I went ahead and stubbed out the geocode_location method in the tests to prevent this. I also refactored a bunch of specs to remove a lot of unnecessary database reads and writes. This reduced the total test time from 9 to 1.5 seconds.

Currently, all of the interactions with external services (Github & Google) are not being tested, so this is something I'll have to address later.