Questions tagged [vcr]

VCR is a ruby tool that facilitates testing HTTP-dependent code by recording HTTP interactions for future playback.

For more information: https://github.com/vcr/vcr

178 questions
1
vote
1 answer

How do you use VCR and Webmock to stub a post request with basic auth?

Disclaimer: I'm new to APIs and I'm well beyond lost after a week trying to solve this seemingly simple problem. I have code that interacts with Github's API that is already implemented correctly but I want to go back and test it using RSpec,…
Aaron
  • 6,466
  • 7
  • 37
  • 75
1
vote
1 answer

VCR Not Recording My Response

I'm trying to record a response that the method images makes a request to open a uri and scrape image(s) from a specific blog. However, when I run the testing suite, VCR does not make the yoko/bot_response inside of the cassettes directory and…
theGrayFox
  • 921
  • 1
  • 10
  • 22
1
vote
1 answer

VCR with Webmock incorrectly stubbing Typhoeus (undefined method `>=' for nil:NilClass)

What I want: External API calls to return the same thing each time the tests run What I get: First time VCR saves it, second time Typhoeus returns an error What happens is I run the test once, it makes the actual requests (that happens when I create…
Tom Prats
  • 7,364
  • 9
  • 47
  • 77
1
vote
1 answer

How can I mock twitter streaming client calls within rspec?

Using rspec and the twitter gem https://github.com/sferik/twitter I am trying to find a solution to mock a twitter stream ideally with a mechanism like VCR. Obviously VCR does not work on tcp socket connections only http requests. If this is too…
Viktor Trón
  • 8,774
  • 4
  • 45
  • 48
1
vote
1 answer

How would I use VCR (with WebMock) in this scenario?

I'm developing a DSL for building API wrappers, named Hendrix. I am having problems with the testing of the DSL. As it is a API wrapper, it needs to interact with external services. I am not sure how to approach this in terms of testing. I'm using…
user2005477
1
vote
2 answers

How do i access the stub_request from within Cucumber > VCR

I would like to fake a network timeout in my cucumber step definition like so: Given(/^the network is timing out$/) do stub_request(:any, 'www.example.com').to_raise(RestClient::GatewayTimeout) end It will give the error that stub_request does…
Mischa Molhoek
  • 164
  • 1
  • 9
1
vote
0 answers

Continuing / resuming with typhoeus?

I have written a script using the typhoeus and vcr gems to pull a large amount of data into a database. Unfortunately I have found some issues with timeouts and errors that are preventing the entire process to complete. It turns out that vcr is…
ylluminate
  • 12,102
  • 17
  • 78
  • 152
1
vote
1 answer

How do I test this third party API integration in rspec?

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…
Bradford
  • 4,143
  • 2
  • 34
  • 44
1
vote
1 answer

Rspec metadata: vcr should only kick in for tagged examples, but works for every example instead?

Simple setup: #spec_helper.rb VCR.configure do |c| c.cassette_library_dir = File.expand_path '../vcr_cassettes', __FILE__ c.hook_into :fakeweb c.ignore_localhost = true c.configure_rspec_metadata! end RSpec.configure do |c| …
artemave
  • 6,786
  • 7
  • 47
  • 71
1
vote
2 answers

Custom Request Matcher for SEOMOZ + VCR

I am trying to integrate SEOMOZ API with VCR. As the API request to SEOMOZ contains parameters that change for the same request over time, I need to implement a custom matcher. Here is what my API call looks like…
Nitish Upreti
  • 6,312
  • 9
  • 50
  • 92
1
vote
0 answers

Any flag to skip using vcr for integration tests using guard-rspec?

The vcr gem is awesome for speeding up a test suite that calls an external API... What is the best procedure to check that the test suite would still pass if VCR is not used? Is there any default way to pass an environment variable or flag to skip…
justingordon
  • 12,553
  • 12
  • 72
  • 116
1
vote
1 answer

VCR ignored parameter: Get real http request

I'm recording http requests with VCR for my test suite. I have to ignore a parameter called callback because the parameter is random, and I don't want VCR to record a new request when this parameter changes (because only the parameter changes, not…
23tux
  • 14,104
  • 15
  • 88
  • 187
1
vote
1 answer

Ruby, record a VCR cassette when clicking link in Cucumber

I have this: @javascript Given A Given /$A^/ do VCR.use_cassette 'a_cassette' do click_link 'a_link' # This makes an AJAX request to external server end end Does not record a cassette, I can't use tag, need this to be done inside step…
sites
  • 21,417
  • 17
  • 87
  • 146
1
vote
1 answer

uninitialized constant VCR when app run in development environment

I'm using VCR to speed up my tests in my rails app and it works like a charm in the test environments But when I physically navigate the site in the developement environment I get the error uninitialised constant VCR when ever I get to a…
Martinffx
  • 2,426
  • 4
  • 33
  • 60
1
vote
2 answers

How to record/playback in different cassettes split by host?

In the project I am working on, we use VCR to store cassettes for both local and external services. The local ones are micro services that are constantly modified while the external ones are hardly modified. Due this reason and plus that the…