I'm wondering if this is possible. I use the VCR gem (http://rubygems.org/gems/vcr) for recording API calls within my models for my unit tests. This works fine. For more higher level testing I'm using Cucumber. In my app I also tes开发者_如何学编程t stuff with google maps markers, geocoder etc. So I'm wondering if there is a solution for providing something like VCR for the client side.
Maybe someone got some ideas,
thx, tux
[EDIT] I forgot to mention that I use Selenium for javascript tests inside cucumber. So JavaScript calls should also be mocked.
Can't you set a different configuration for your tests? Something like: var gmaps_url = test ? "http://localhost:1234" : "http://maps.google.com";
Another idea could be using backbone-js (http://documentcloud.github.com/backbone/) on your javascript code. It makes it easier to unit test your javascript code.
精彩评论