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

Custom VCR request matching options for some specific RSpec tests

I have a bunch of RSpec tests in my Rails project that test HTTP calls to external REST API and use VCR cassettes to record requests and respondes. Currently my VCR configuration is the following: VCR.configure do |c| c.cassette_library_dir =…
cansadadeserfeliz
  • 3,033
  • 5
  • 34
  • 50
1
vote
0 answers

How should I load VCR results in a Turnip acceptance spec?

I have a web request that ultimately calls an external service, merges data in our db, then presents results. I think I can ignore a JS based setup (make request, queue job, return polling js) as it looks like I'll have the same question if this is…
blu
  • 12,905
  • 20
  • 70
  • 106
1
vote
1 answer

How to tell if VCR completed the cassette

How can I tell if VCR has consumed all the recorded data? If the tested program terminates the API accesses or does none at all, the VCR test still completes normally (the test checks for no error raised and a completion message at the end). There…
George Shaw
  • 1,771
  • 1
  • 18
  • 32
1
vote
1 answer

Test with VCR not rolling back database changes

I've been dealing with a set of failures where a VCR-enabled test adds an additional record to my Projects table, and that record persists across additional tests, causing failures, rather than being rolled back at the end of the test. Specifically,…
Dan Kohn
  • 33,811
  • 9
  • 84
  • 100
1
vote
1 answer

After filtering sensitive data using VCR, re-running the spec fails with bad URI error

According to what I'm reading here: https://relishapp.com/vcr/vcr/v/1-11-3/docs/configuration/filter-sensitive-data, When the interactions are replayed, the sensitive text will replace the substitution string so that the interaction will be…
rainslg
  • 415
  • 5
  • 11
1
vote
1 answer

Does a custom matcher or match_requests_on override playback repeats?

I have an integration test for some code that sends SMS messages. The test sends the initial message, say, "Hello, world", and uses VCR to validate the call to the external SMS provider was made via an HTTP API. The test then simulates sending a…
Martin Streicher
  • 1,983
  • 1
  • 18
  • 18
1
vote
1 answer

Show ruby VCR stats after running tests?

Is there a way of knowing how many requests are happening when you run your tests and could be cached by VCR. Is there a way of knowing how many of those are getting read from the VCR cache? Thanks
fabro
  • 731
  • 6
  • 11
1
vote
1 answer

Setting up VCR with Cucumber & Capybara

I have the vcr and webmock gems installed. features/support/vcr_setup.rb: require 'vcr' VCR.configure do |c| c.cassette_library_dir = 'vcr_cassettes' c.hook_into :webmock end features/step_definitions/user.rb: VCR.use_cassette('login to…
Jackson Cunningham
  • 4,973
  • 3
  • 30
  • 80
1
vote
0 answers

Record and playback inbound HTTP requests to Rails app in RSpec?

I'm writing specs for a Rails controller that receives HTTP JSON requests, and returns a response to those requests. In my test suite, I'd like to have some fixtured HTTP requests that I can play back against my application. Sample code: context…
David Elner
  • 5,091
  • 6
  • 33
  • 49
1
vote
1 answer

When I use VCR ignore_hosts configuration option all my other requests fail

I am using VCR with cucumber. I want to ask VCR to ignore all requests to "api.stripe.com" and do not deal with them. Let the requests go through to the real Stripe API server. But only those. I want the rest of the requests to be handled by VCR.…
p.matsinopoulos
  • 7,655
  • 6
  • 44
  • 92
1
vote
1 answer

How to use Capybara 'visit' with domain constrained routes?

I have domain constrained routes in my rails app: constraints domain_constraints do # Routes definition goes here end And I want to use capybara visit to visit those route. I tried to set Capybara.default_host and Capybara.app_host to one of my…
henggana
  • 157
  • 1
  • 8
1
vote
1 answer

VCR + Webmock + net_http + NTLM not working without monkey patch

In order to get NTLM working with Webmock + net_http, I need the net_http_connect_on_start option enabled. For example, in the console, or the beginning of a spec, I can use: WebMock.allow_net_connect! net_http_connect_on_start: true but VCR…
pduey
  • 3,706
  • 2
  • 23
  • 31
1
vote
0 answers

VCR creates a file but doesn't put anything in it

I am trying to test a parser that uses Faraday with VCR. The test passes the first time and creates an empty cassette. When I run it again it hits the empty cassette and fails. I have tested the parser in the console and it works every time. Here…
Glen
  • 144
  • 1
  • 1
  • 7
1
vote
0 answers

Request not running when using hydra and vcr gem

I am currently trying to do a post request whilst using typheous and hyrda. I am using VCR gem for testing the response. I am currently getting the following error: ArgumentError: comparison of Array with Array failed When I run this line:…
Andrew_tainton
  • 261
  • 1
  • 3
  • 13
1
vote
0 answers

testing stripe checkout with cucumber and WebMock/VCR in my Rails app(fails without connection to the internet)

Cucumber step that fails. When there is no internet connection. It can't download stripe checkout https://stripe.com/docs/checkout but how to fix or stub it I don't know :( Sorry if the question is not very clear, my english is sucks. Test where I…
Artem Sychov
  • 142
  • 1
  • 3
  • 15