-
-
Save mariusbutuc/dbcd9aa8788485b5b7c0 to your computer and use it in GitHub Desktop.
VCR - ignore specific requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# … | |
VCR.configure do |c| | |
c.hook_into :webmock | |
c.cassette_library_dir = 'spec/cassettes' | |
c.default_cassette_options = { :record => :new_episodes } | |
## Ignore some requests based on the hosts involved. | |
c.ignore_hosts 'localhost', '8.8.8.8', 'our.local.test.server.org' | |
## Ignore some requests based on their properties. | |
# The block passed to c.ignore_request has to | |
# return TRUE for every request you wish to | |
# ignore when recording or reading a VCR cassette. | |
c.ignore_request do |request| | |
uri = URI.parse(request.uri) | |
# Ignore Toxiproxy requests (127.0.0.1:8474) | |
uri.host == '127.0.0.1' && uri.port == 8474 | |
## Ignore requests using a specific HTTP method | |
# The following methods are available: | |
# :head, :options, :get, :post, :put, :patch, :delete | |
request.method == :head | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment