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

VCR BadAlias error when used with Cucumber tag

I have to feature steps @vcr Given A @vcr Given B and its definitions: Given /^A$/ do a_method_that_makes_a_request end Given /^B$/ do a_method_that_makes_a_request end This fail with: Unknown alias: 70305756847740 (Psych::BadAlias) The…
sites
  • 21,417
  • 17
  • 87
  • 146
2
votes
1 answer

Ruby TestUnit, VCR and HTTP API Requests

I am building an API wrapper and am writing some tests for it and I have a couple of questions. 1) How do I write an assert for calls where data doesn't exist? For example, looking up a member by id using the API but the user won't exist yet. 2) How…
dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189
2
votes
1 answer

How can I automate the periodic running of my specs and get notified when they fail?

I a wrote recipe screen scraper. Because of how easy it is for screen scrapers to break I wrote some specs that test various websites for the expected output. On my development enviorement i'm using VCR so I don't have to keep making calls to…
hadees
  • 1,754
  • 2
  • 25
  • 36
2
votes
1 answer

Test response of Rails 3 background job (API-Request) with VCR in Cucumber feature

I have a Rails 3 background job (delayed_job) which sends a hipchat / Campfire message to their API and I want to check the response in my Cucumber feature. Is there a way to get the last HTTP response(s) which VCR have recorded? The feature looks…
tbuehl
  • 178
  • 1
  • 6
2
votes
1 answer

How can I tag cucumber scenario outline examples for use with VCR cassettes?

I'd like to apply a different VCR cassette based on the tag on the example. As far as I can tell, tagging cucumber scenario outline examples is possible, but I can't get VCR to recognize any of the tags. Is this possible? VCR.cucumber_tags do |t| …
Eric M.
  • 5,399
  • 6
  • 41
  • 67
1
vote
0 answers

Storing selenium driver pages when run test to improve performance

I was using an internal API to get the data from a website and I stored this requests using a VCR(cassette), but this API is no longer available. Therefore, I'm using Selenium to handle pages and scrap the data that I need, but, to improve the…
1
vote
1 answer

JSON::ParserError: unexpected token at '' on Rails Rspec

I'm quite having an issue on my Rspec. So basically what I want is to send a request to the API, and have a proper response. When I send the data to the API endpoint, and I puts what it sends, it looks like it sends all the data correctly, but at…
theKid
  • 522
  • 6
  • 19
1
vote
0 answers

How to add filter_sensitive_data object in VCR Cassette JSON file?

Below is my VCR configuration file VCR.configure do |c| c.cassette_library_dir = 'spec/fixture/vcr_cassettes' c.hook_into :webmock c.configure_rspec_metadata! c.default_cassette_options = { serialize_with: :json } …
1
vote
2 answers

Using python vcr with Google Video Intelligence - error with request

I'm having a strange google video intelligence api request error when I run a test with python vcr. I was wondering if anyone else has seen this error, and if so, why we have this and how to solve it? I use VCR to mock the request to video…
OneWorld
  • 163
  • 2
  • 12
1
vote
1 answer

When using vcr / cassettes in rspec, is there a way to change match_requests_on per test?

I'm using vcr in rspec to match save urls and play them back, in the config I'm using the following settings for match_requests_on : match_requests_on: [:method, :host, :path] However I want to modify this config for certain urls only, for example…
CafeHey
  • 5,699
  • 19
  • 82
  • 145
1
vote
1 answer

Vcrpy with GoogleCloudVision

I am writing a test for getting label data from Google Cloud Vision API. Within the test I am using vcrpy to store the results of my label retrieval. with vcr.use_cassette( vcr_cassette_path.as_posix(), record_mode="twice", …
Jacob O
  • 43
  • 2
  • 8
1
vote
2 answers

VCR gem - Can I store my response data in a separate JSON file?

Using the VCR gem, responses are saved as a large string inside the YAML cassette file. Like this: response: body: string: '{"data":{"salesforceObjects":{"records":[{"student":{"accountId" ... However, is it possible to save this JSON in…
Marco Prins
  • 7,189
  • 11
  • 41
  • 76
1
vote
0 answers

How to store only the latest API response in Rails VCR Testing?

We are using the Ruby VCR library to mock and replay responses from various APIs. In one function that we have, our code continuously polls an API endpoint until the response is ready. The VCR Cassette is storing each of these polling requests, with…
Abundance
  • 1,963
  • 3
  • 24
  • 46
1
vote
0 answers

VCR.request_matcher.uri_without_params method but for ignoring dynamic body values

I am wondering if there is an out-of-the-box solution for ignoring certain body properties when matching requests on :body? When I record VCR data, I am utilizing one endpoint to handle two requests with similar data. If I match on the default…
1
vote
1 answer

Stub class and return VCR response

I have a class Translator which has call to class Connector. Connector class does request to external API, wanted to use VCR to record this API action, then stub instance of Connector class and return VCR response of the API action in call…