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

How can i match a dynamically changing url in VCR

In my Ruby on Rails application there are 2 Localhost servers running. I am writing test cases for the 1st server and so I have to mock the 2nd server. For this I am using VCR to record the responses I get from the 2nd server and play the recorded…
3
votes
1 answer

How can I configure VCR to use cassette names that match the request?

I am using rspec/capybara/VCR to record tapes. Currently my tapes are automatically named to include a simplified version of the hierarchy of the test that is being run, as is the default. I would like to configure the cassette naming scheme so that…
Eric
  • 5,815
  • 3
  • 25
  • 34
3
votes
1 answer

Is it possible to re-record VCR cassettes without running the test suite?

I have a ~ 2.5GB collection of VCR cassettes https://github.com/vcr/vcr. I am using version 3.0.1. I need to re-record the cassettes from time to time. But, since running the tests takes considerably longer than just firing the requests and…
johannesch
  • 125
  • 1
  • 5
3
votes
1 answer

using VCR with Rspec in feature scenarios

I have a Rails 4 app that uses a custom authentication gem that authenticates users against a third-party API. The app requires authentication for most actions on the site (visitors can do very little). I am trying to use VCR to record the api…
johndavid400
  • 1,552
  • 13
  • 15
3
votes
0 answers

Webmock and VCR, allow Http Connections if there is no cassette

I have a problem, I can run a test that uses vcr on its own and it works, it creates the cassette and it uses that on the next test. Great. The problem is when I run all my tests together this particular test fails, because webmock disables http…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
3
votes
2 answers

Feedjira: VCR not recording cassetes

I have a very simple controller that grabs some data from rss using Feedjira. I want to test this controller by recording the RSS response. Here is the controller code: def index @news = Feedjira::Feed.fetch_and_parse…
Daniel Cukier
  • 11,502
  • 15
  • 68
  • 123
2
votes
1 answer

Replace sensitive data in VCR gem cassettes request body

I am able to remove sensitive headers using filter_sensitive_data but it does not seem to be working for replacing sensitive data in the request body. VCR configuration VCR.configure do |config| config.cassette_library_dir = 'spec/vcr' …
house9
  • 20,359
  • 8
  • 55
  • 61
2
votes
0 answers

How to fix output of stream API for testing purposes in the same way that a vcrpy cassette does for http requests?

I have some python code that normally sends http requests. This code is easy to test because I can record a vcrpy cassette and thereafter I can set record_mode='none' to ensure that I get the same response every time I run the test. I am now writing…
numberwang
  • 39
  • 5
2
votes
0 answers

Heroku CI - VCR - Rspec - Fixtures not used for my Rspec tests

I'm using the VCR gem that records lots of http requests and saves them as fixtures in fixtures/vcr_cassettes. It works fine locally, but it seems that when I deploy on Heroku, the fixtures is not used and the tests uses real http requests, which…
2
votes
1 answer

Hiding sensitive data in VCR

In a recorded cassette from VCR gem I've got: http_interactions: - request: method: get uri: https://nme_site/rest/api/2/search?.a_lot_of_data body: encoding: US-ASCII string: '' headers: Accept: -…
mr_muscle
  • 2,536
  • 18
  • 61
2
votes
1 answer

How to ignore the request body match for an specific host in rspec VCR?

I have ElasticSearch and Kibana integration with my rails application, and i use they for log and measure requests to external API's. I don't want that VCR match the body for ElasticSearch requests records, because there are a "current time"…
2
votes
1 answer

Testing a Thor script with rspec and vcr

I built a Thor script that connects to an HTTP API to perform some very simple actions. I've coded tests for the backend but the Thor script is basically untested, which is quite suboptimal. My first approach was to capture the output of the…
ngw
  • 1,222
  • 1
  • 14
  • 34
2
votes
1 answer

Where to put VCR config when using both rspec and cucumber

I'm using both rspec and cucumber. Cucumber of integration level tests, but rspec for unit tests. I'm using vcr for cucumber already, but want to use it for rspec, too. Where's the right place to put the vcr configuration? I'd rather not…
John Hinnegan
  • 5,864
  • 2
  • 48
  • 64
2
votes
1 answer

VCR recording an external API protected by a temporary access token

I would like to test several end points of an external API that require an access token in order to use them. The problem is that the access token expires after 60 minutes. The only options I can think of are: To hard code the access token for a…
amayer171292591
  • 240
  • 3
  • 12
2
votes
2 answers

removing VCR cassette does not cause RSpec to fail

I was having trouble getting VCR to re-record cassettes, so I tried deleting the cassette altogether, and was shocked to find my test suite continued passing. How is this possible? My understanding is that the cassettes are the fixtures used to…
williamcodes
  • 6,317
  • 8
  • 32
  • 55