179
questions
0
votes
0
answers
51
views
How to skip VCR body validation for specific files using RSpec?
In the company I work at, we are facing the following issue: initially we set our RSpec vcr config not to match request bodies. Currently we're trying to implement request body match, but we're left ...
0
votes
0
answers
21
views
Ruby VCR testing is not capturing http calls from sinatra
I've got a Sinatra app which has the following call in it;
get '/test' do
@res = Net::HTTP.get_response(URI('http://www.iana.org/domains/reserved'))
erb :test
end
With view;
<%= @res....
1
vote
0
answers
22
views
How is vcrpy importing from a parent directory in a test file
In the vcrpy github project, the test file is referring a package assertions in a parent directory. I assume it should have referred it as from ..assertions import .... to refer it correctly.
Also, I ...
1
vote
0
answers
79
views
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 ...
-1
votes
1
answer
85
views
Is it possible to use VCR gem in Ruby to record an outgoing message and expect that the correct message is sent?
This would be the same functionality as Webmock. Except it would take a cassette instead of a string.
Something like expect(Webmock)to receive...
0
votes
2
answers
420
views
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 ...
0
votes
1
answer
2k
views
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": "...
0
votes
1
answer
268
views
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 "...
1
vote
2
answers
532
views
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 ...
0
votes
1
answer
212
views
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 ...
0
votes
0
answers
301
views
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(...
1
vote
2
answers
2k
views
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 ...
1
vote
1
answer
4k
views
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 ...
5
votes
0
answers
342
views
VCR not playing well with CircleCI
We are using VCR to record http requests for our tests in a Rails application. The cassettes are currently committed to source but CircleCI does not seem to use them as CircleCI makes new requests ...
2
votes
1
answer
1k
views
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|
...
3
votes
0
answers
583
views
Possible to load VCR cassette inside before(:create) in factory_bot Factory?
I am trying to stub a call that is made when validating a connection made based on settings during the create process on my model.
Disabling the callbacks seems messy as it means maintaining several ...
0
votes
1
answer
502
views
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 ...
1
vote
2
answers
912
views
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("...
0
votes
0
answers
934
views
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....
3
votes
0
answers
284
views
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 ...
-1
votes
1
answer
535
views
Does vcrpy's record_mode=None guarantee no HTTP requests will be sent even if the requests are made in a thread?
I am testing some code with pytest and using the vcrpy decorator as follows:
@pytest.mark.vcr(record_mode='none')
def test_something():
make_requests_in_a_thread_and_save_to_queue()
...
0
votes
0
answers
196
views
Rails Minitest API connection - NoMethodError: undefined method `call'
I want to create a Minitest for service responsible for creating data inside of external provider and updating few things in my db. To do so I'm using VCR and below test:
#test/services/...
1
vote
0
answers
208
views
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 = {
...
1
vote
2
answers
480
views
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?...
1
vote
1
answer
2k
views
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 ...
3
votes
0
answers
381
views
Is there a way to use vcrpy for requests made from a different process?
I'm trying to use vcrpy to record and replay requests.
Issue is, those requests are happening on a different process and it looks like vcrpy doesn't work on that.
code looks something like this:
...
1
vote
1
answer
152
views
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....
1
vote
2
answers
1k
views
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&...
0
votes
1
answer
202
views
VCR failing to record subsequent requests
I have a system spec whose code under test makes 2 external HTTP requests.
I'm wrapping my whole test with VCR.use_cassette, but for whatever reason VCR is only recording the first of my two requests.
...
0
votes
0
answers
178
views
Switching form to remote: true breaks VCR
I have a test that looks like this.
RSpec.describe 'Modify visit summary letters', type: :system do
scenario 'with one correspondence relationship' do
VCR.use_cassette 'correspondence/faxes/...
7
votes
0
answers
5k
views
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(&...
0
votes
2
answers
4k
views
Expressions can only be used to update, not to insert
i got this issue when trying to create object using Factory boy and unittest.mock for mocking payment
self = <django.db.models.sql.compiler.SQLInsertCompiler object at 0x7f5aa2913400>, field = &...
2
votes
0
answers
207
views
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 ...
-1
votes
1
answer
691
views
What service should I use for changing coupon status in VCR and EMD?
I have vcr and EMD. All ones have coupon status OK.
I need to change it on EXCH.
There is a commands
VCRSTATUS/C1/TO-EXCH-REF TO MCO0010010111222
WEMDSTATUS/C1/TO-EXCH-REF TO MCO0010010111222
but it ...
0
votes
1
answer
236
views
Why are records not being stored to the db when testing with VCR?
I have an interactor foo with method perform on it which makes an API call, and records the response through ActiveRecord. It works fine. I have a spec for it that triggers the method with FactoryBot ...
0
votes
1
answer
557
views
Ruby VCR gem disable re recording when a recording is available
I want to record the API response once and use is forever but it seems like VCR wants to re-record after sometime is elapsed.
I tried to google how to disable it. Found re_record_interval but it ...
2
votes
1
answer
2k
views
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: ...
0
votes
1
answer
266
views
RSpec check if message has been sent on Slack
I've got a class which is responsible for send a direct message on Slack to every reporter who has not updated his Jira ticket in 2 days. To send message, described class used send_message method (...
4
votes
1
answer
766
views
Run Specs With VCR without explicitly specifying the cassette name
I have capybara feature specs I intend running without explicitly specifying a cassette name. E.g:
scenario "by searching via a title" do
visit root_path
fill_in "search", with: "cheddar"
...
0
votes
1
answer
300
views
Create http fixtures simulating request coming from outside
I have a rails app with some rspec feature tests. This app Alice works in tandem with another program Bob
When i want to use Bob, i create a json file in a specific url with instructions in my Alice ...
0
votes
1
answer
597
views
VCR cassette Rails
My product keys are encrypted using aws kms.
Can I create a cassette with my credentials for aws and then use same answer for other credentials?
To encrypt key, I send a plaintext to kms, ...
0
votes
1
answer
420
views
is it possible to use ruby vcr gem without passing a block of code
I want to use Cypress as a testing tool with the cypress-on-rails plugin.
However during a cypress scenario I want to enable/wrap all rails backend requests with vcr so all requests are captured and ...
4
votes
0
answers
414
views
Is it possible to persist VCR cassettes generated from tests run on CircleCI
We are using VCR to record http requests for our tests in a Rails application. The cassettes are currently committed to source, and every month we rerecord the cassettes manually and commit the new ...
2
votes
1
answer
2k
views
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 ...
1
vote
0
answers
430
views
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 ...
5
votes
2
answers
2k
views
VCR: "There is currently no cassette in use." when creating a second cassette
I'm attempting to do RSpec feature tests on an external API.
My VCR config is as follows:
VCR.configure do |config|
config.cassette_library_dir = 'spec/vcr'
config.hook_into :webmock
config....
3
votes
1
answer
1k
views
how do I dynamically generate multiple HTTP mock responses with VCR for Ruby/RSpec?
I'm hitting an API and for each request, there was a recorded request/response in the cassette YAML file. However, the only difference between the requests was the id in the query parameters.
How do ...
1
vote
0
answers
891
views
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 ...
2
votes
1
answer
1k
views
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 ...
3
votes
2
answers
3k
views
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 ...