'VCR record HTTP interactions with webmock create .yml without values
I am doing HTTP interaction with Ganache - ethereum testnet. Ganache url : http://127.0.0.1:7545. I connect to its by ethereum.rb gem, which using I think Net::HTTP lib: class from ethereum.rb gem which establishes connect to ethereum net spec/support/vcr_setup.rb:
require 'vcr'
# spec/support/vcr_setup.rb
VCR.configure do |c|
#the directory where your cassettes will be saved
c.cassette_library_dir = 'spec/vcr'
c.stub_with :webmock
end
spec/support/webmock.rb:
require 'webmock/rspec'
# spec/support/webmock.rb
WebMock.disable_net_connect!(allow_localhost: true)
my rspec test:
require 'rails_helper'
describe ::EthereumApi::Rpc do
it '#.client' do
VCR.use_cassette 'public_blockchain/rpc/client' do
client = ::Ethereum::HttpClient.new('http://127.0.0.1:7545')
first = client.eth_accounts['result'][0]
expect(first).to eql('0xd1d2982db68fe27216c86c2a03fc4ef136ff8ce2')
end
end
end
And as the result a get .yml file with keys but without values:
.yml without values spec/vcr/some_folder/my_test.yml:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
