Skip to content

Instantly share code, notes, and snippets.

@arax
Created December 6, 2012 17:56
Show Gist options
  • Save arax/4226541 to your computer and use it in GitHub Desktop.
Save arax/4226541 to your computer and use it in GitHub Desktop.
VCR - ignore specific requests
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|
## Ignore requests made to port 666
# URI(request.uri).port == 666
## 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