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

Testing rate-limited external API calls with VCR and RSpec

In my Rails project, I'm using VCR and RSpec to test HTTP interactions against an external REST web service that only allows calls to it once per second. What this means so far is that I end up running my test suite until it fails due to a "number…
Paul Fioravanti
  • 16,423
  • 7
  • 71
  • 122
1
vote
0 answers

FakeWeb::NetConnectNotAllowedError

I am trying to test my app and remote control. I use Rails 3.2 and lastest version of vcr and fakeweb. Actually I have watched RailsCast and now i want to do anti testing but I cannot. My request test file; require "spec_helper" describe…
eayurt
  • 1,169
  • 1
  • 19
  • 42
0
votes
1 answer

Unable to record Whois requests with VCR?

I'm attempting to use VCR 2.0.0 outside of Rails. VCR seems to create the vcr_cassettes directory perfectly when I run the specs. However, the tests seem to be still hitting the network and there are never any yaml cassettes to be found in the…
David Tuite
  • 22,258
  • 25
  • 106
  • 176
0
votes
0 answers

VCR installation breaks my current specs with WebMock

I'm working on a project which already had a lot of specs using WebMock. Now we decided to try to install VCR and a couple of things are happening. I created a test that runs inside a VCR.use_cassette block Now that test fails if I dont add the…
PedroNeves
  • 110
  • 10
0
votes
0 answers

How to run Pytest for zeep while offline?

I'm having a hard time testing zeep actions while offline. I'm using pytest-vcr to record the initial test. When I run my tests a subsequent time, they fail even though a cassette exists for the interaction. I suspect that zeep tries to communicate…
adamz88
  • 319
  • 3
  • 12
0
votes
2 answers

How can I test the POST request an external webhook makes to my application?

Folks this is my scenario There is this external webhook that I would like to test Is there a way to use VCR or some other tool to record the POST request the webhook makes to my rails app so I can use it in Rspec to run my tests? The webhook's body…
0
votes
1 answer

How do I match a VCR request when a part of the body is variable and cannot be predicted?

I want to test an API client performing REST requests. The requests look like this: # vcr/attachments.yml - method: POST - path: http://example.org/attachments - body: { "filename": "foo.jpg", "signature": "6g33jk2C1QQn9EM8Q==" } - response: 200…
Kemenaran
  • 1,421
  • 12
  • 11
0
votes
1 answer

How make stub on request with VCR?

How can I do stub on request with VCR? The problem is that real request is made in the test, which I want to stub. RSpec.describe CreditRegisterLoader do describe ".call" do it "should create credit institutions", :vcr do …
0
votes
2 answers

GitHub Actions Failing : Ignore Local Host Error

I am having an odd issue with running specs only on github actions, and it is not respecting the ignore local hosts setting. Is there something we need to add to the config to make our settings work with GitHub Actions? Error Run bundle exec rspec…
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
0
votes
1 answer

VCR configuration issue for cypress-on-rails

I followed the instruction in the README: https://github.com/shakacode/cypress-on-rails to set up cypress-on-rails (and it itself runs fine) but when I try to configure VCR for it (following the cypress-on-rails instructions). I keep getting the…
olminkow
  • 121
  • 13
0
votes
0 answers

Invalid Record User Must exist - Rspec

I'm making some unit testing with rspec to Active Campaign and on the response I encounter this error: Failures: 1) Create Token for Active Campaign updates a contact Failure/Error: expect(response_body).to eq(200) expected:…
theKid
  • 522
  • 6
  • 19
0
votes
1 answer

In Rspec, how do I set the VCR record mode in the feature description?

I have a test that uses VCR like this: describe 'Do something with an api', feature: true, js: true, vcr: true do end I want to set this vcr recording to the option new_episodes (it's currently set to once) but I can't find out how to pass this…
CafeHey
  • 5,699
  • 19
  • 82
  • 145
0
votes
1 answer

Reduce duplicate VCR.use_cassette scenarios to common subject

Using VCR in my rspec test and everything is working fine. But I wanna improve the code quality as I have used multiple times same code VCR.use_cassette in my test. Here is the test:- context 'when request authenticated and Params are valid' do it…
Haseeb Ahmad
  • 7,914
  • 12
  • 55
  • 133
0
votes
1 answer

VCR not using cassette in rails system test

In the following test: require "application_system_test_case" class ImportTest < ApplicationSystemTestCase test "importing vacancy succeeds" do VCR.use_cassette("import_success", record: :all) do user = users(:role) …
mhenrixon
  • 6,179
  • 4
  • 40
  • 64
0
votes
0 answers

Subscription Stripe testing with RSPec and VCR

Hello I am testing the stripe subscription and I am having a trouble when I called a method because appear this error when I try to run the test: Failure/Error: data_stripe = Stripe::Subscription.create({ customer: user.stripe_id, …
AldoAx2
  • 1
  • 1