Reputation: 4193
My project is a rails app that extends some third party API. A lot of the requests rely on third party API calls. How should I test these cases in rspec? Should I use VCR and actually just hit the third party (then mock future requests)? Or should I just download the payload into a fixture manually and stub requests with webmock and find a way to bypass the oauth process? Are the better solutions?
Note that it uses OAuth, but I don't use omniauth.
Sometimes the API limits me to fetching N records at a time, so I have to paginate them. There could be instances where I'm making 25 requests just to get the data I need, but this is mostly for the sync rake tasks.
Upvotes: 1
Views: 776
Reputation: 3540
There is no need to download a payload manually, as this is exactly what VCR does for you. VCR creates a yaml fixture, that it uses for all future requests.
Upvotes: 2