You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use both Webmock and VCR. In some cases, I don't use VCR and I just use Webmock.
When I do something like this:
stub_request(:post,'https://api.github.com')
but my request does
POST 'https://api.github.comm' #note extra 'm'
I get a VCR error:
An HTTP request has been made that VCR does not know how to handle:
POST https://api.github.comm
There is currently no cassette in use. There are a few ways
you can configure VCR to handle this request:
...
I would expect that in such cases, Webmock would be the one handling the error. The reason for this is that Webmock gives much more details of what are the registered stubs and what was the request that has been made.
I have been searching how to configure this behaviour, but I don't find the exact configuration values. Am I missing something or is it a bug?
Config
require 'vcr'
require 'webmock/rspec'
VCR.configure do |config|
config.cassette_library_dir = 'fixtures/vcr_cassettes'
config.hook_into :webmock
config.ignore_localhost = true
config.configure_rspec_metadata!
config.allow_http_connections_when_no_cassette = false
end
davidgm0
changed the title
Mock error handling with allow_http_connections_when_no_cassette = true should be delegated to mocking framework
Mock error handling should be delegated to mocking framework
Mar 22, 2024
I use both Webmock and VCR. In some cases, I don't use VCR and I just use Webmock.
When I do something like this:
but my request does
I get a VCR error:
I would expect that in such cases, Webmock would be the one handling the error. The reason for this is that Webmock gives much more details of what are the registered stubs and what was the request that has been made.
I have been searching how to configure this behaviour, but I don't find the exact configuration values. Am I missing something or is it a bug?
Config
Ruby 2.7.6
Gem 3.1.6
Webmock 3.18.1
Rails 5.2.8.1
Rspec 3.11
The text was updated successfully, but these errors were encountered: