Reputation: 2208
I am making heavy use of 3rd party API's (google contacts,etc) in my application. I am pretty new to testing in rails, but ever since I find it very difficult to test my models which rely on the response on an api. My ultimate goal is to test valid return values from my models, therefore they get initialized with values from the api. So I was wondering how can I test this. Of course it would be possible to call the api and just pass the values, but this would take plenty of time. Is there maybe a nice way of mocking api responses?
Best, Phil
Upvotes: 0
Views: 439
Reputation: 10744
you can use this gem:
You have various resources to learn how it works:
http://railscasts.com/episodes/291-testing-with-vcr
Regards!
Upvotes: 2