whichdigital / active-rest-client

ActiveRestClient API Client
https://rubygems.org/gems/active_rest_client
MIT License
385 stars 44 forks source link

Active-rest-client with VCR and Faraday #60

Open inv-vinoth opened 10 years ago

inv-vinoth commented 10 years ago

I would like to use ARC with VCR. I see that we can use faraday and use VCR for testing. Below is the configuration part which i have tried.

Active-rest-client faraday configuration. https://github.com/whichdigital/active-rest-client#faraday-configuration

VCR provides a middleware that can be used with Faraday for testing. https://www.relishapp.com/vcr/vcr/v/1-6-0/docs/middleware/faraday-middleware

Below is my spec_helper.rb configuration. http://pastie.org/private/mttyymqlkw0dwxudw8h7na

Below is my user_spec.rb http://pastie.org/private/rhvfdswceev0sgkvjxajw

When I tried to run our user-spec. I got the below trace. Undefined method “to_hash” for nil:NilClass http://pastie.org/private/rubppjag0gxg5msz1pngq

This lead to me a bug which has been posted in vcr gem that VCR does not work with Faraday 0.9.0 and up and it’s a known issue. https://github.com/vcr/vcr/issues/386

I tried to downgrade Faraday with 0.8.9, but unfortunately Active-rest-client gem does not work below Faraday 0.9.0. Is it possible to run ACR with Faraday 0.8.9 and below?.

mattsnyder commented 9 years ago

Encountered the same thing. Using Faraday and VCR and am receiving the undefined methodto_hash'` when executing

VCR.use_cassette('myrecording') do