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
9
votes
2 answers

Is it correct to store vcr cassettes in repository?

I develop a Ruby interface for one REST api. I use rspec and vcr for testing. All tests use credentials of account, specially created for it. I can't decide: is it correct to store cached responses of my tests(vcr cassettes) in repository, or allow…
user1291365
  • 516
  • 1
  • 4
  • 16
8
votes
2 answers

Name of current example/group in rspec hook

I'm adding an rspec hook that will allow me to switch on vcr and use the name of the current example as the cassette name. it "should have collaborators", :vcr => :once do # web interactions end config.around(:each, :vcr => :once) do |example| …
opsb
  • 29,325
  • 19
  • 89
  • 99
8
votes
1 answer

VCR throwing cant handle request on the second attempt to run test(first attempt passes)

I have VCR set up and it runs on several tests I have written without issue. The most recent test I tried to write will pass the first time it is run, but will remain failing after that unless I delete the cassette. The code for the test is: it…
ruby_newbie
  • 3,190
  • 3
  • 18
  • 29
8
votes
0 answers

Equivalent of VCR for NUnit

We've written a basic networking application using C# and .net. For tests, we'd love to use something similar to Ruby's VCR. Does such a thing exist for C#/.net ?
Geremy
  • 2,415
  • 1
  • 23
  • 27
7
votes
0 answers

SSL: WRONG_VERSION_NUMBER during python requests.get

I am trying to access a pypi url like this: PYPI_URL = https://pypi.org/pypi/Django/json try: response = requests.get(PYPI_URL) except requests.exceptions.RequestException as err: print("Unable to access Pypi. ", err) But when I am trying…
urawesome
  • 198
  • 1
  • 10
7
votes
1 answer

How to get tests to record fixtures with AngularJs like vcr in Rails?

I've been looking everywhere, I tried node-replay but with protractor but it won't work with selenium. I've also tried vcr.js and sepia. How do I go about setting up my tests for that they make the initial calls but store them as cassettes like…
Joseph Le Brech
  • 6,541
  • 11
  • 49
  • 84
6
votes
1 answer

VCR says "no cassette in use" even after specifying cassette

I have an api-only RoR app with a user model. Users are authenticated via Twilio/Authy (using this gem). Each user has_one authy_user model for storing authy info, with dependent: :destroy. The authy_user model has a before_destroy hook that…
6
votes
1 answer

Filtering out JWT and Bearer tokens with VCR

I'm working with the Google Drive API via the Google Drive Ruby gem and using VCR to record requests. I'm authenticating via JWT under the hood, and want to filter out both the JWT request and the bearer token which gets returned. As I don't know…
Pezholio
  • 2,439
  • 5
  • 27
  • 41
6
votes
1 answer

VCR::Errors::UnhandledHTTPRequestError in a controller test using VCR

I'm trying to mock a api call in which I upload a file, I'm using Wistia Upload API and because I don't want to hit the server with every test, I'm trying VCR for the first time. I have the following test in my spec/controllers folder: let(:file) {…
Uriel Hernández
  • 731
  • 3
  • 9
  • 23
6
votes
3 answers

Using specific VCR cassette based on request

Situation: testing a rails application using Rspec, FactoryGirl and VCR. Every time a User is created, an associated Stripe customer is created through Stripe's API. While testing, it doesn't really makes sense to add a VCR.use_cassette or describe…
Philippe Dionne
  • 103
  • 1
  • 6
5
votes
1 answer

Using VCR with Cucumber via tags

I have some Cucumber features which need to interact with the Google Maps Routing API. I'm trying to stub out these interactions using VCR. I have added a VCR tag to my features like so: @google_routing_api @javascript Scenario: Creating a bus …
David Tuite
  • 22,258
  • 25
  • 106
  • 176
5
votes
0 answers

Stub controller redirect_to external url with VCR

Some third-party service which I want to use requires user to log in on their webpage. Handy url is generated in controller below. User goes there and come back to my service after his authentication succeeds class MyController <…
Filip Bartuzi
  • 5,711
  • 7
  • 54
  • 102
5
votes
1 answer

Rspec + savon + vcr not recording

I can't record anything with vcr, I have such setup: spec_helper.rb require 'vcr' VCR.configure do |c| c.cassette_library_dir = 'spec/cassettes' c.hook_into :webmock c.configure_rspec_metadata! c.default_cassette_options = { :record =>…
zrl3dx
  • 7,699
  • 3
  • 25
  • 35
5
votes
1 answer

vcr breaks from multiple web requests

A project that I am working on has integration tests which actually go out and hit a 3rd party api over the wire... Running these tests takes a very long time. I suggested that we implement something like VCR so that the data the tests interact…
patrick
  • 9,290
  • 13
  • 61
  • 112
5
votes
4 answers

vcr does not know how to handle this request

Hi I am trying to test google auth with cucumber using vcr with a tag. Everything goes fine till token expires. I think when it expires this happens But I have a file with this content http_interactions: - request: method: post uri:…
sites
  • 21,417
  • 17
  • 87
  • 146
1
2
3
11 12