Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Per-Service VCR Cassettes - Reuse Common API Requests Across Your App's Tests
# This assumes you have a client with a URL config. Hard coded URLs work too.
# Will automiatically insert cassets whenever needed and organize them per servcie.
#
VCR.configure do |c|
c.around_http_request do |request|
if request.uri =~ Regexp.new(MyServiceClient.config.url)
VCR.use_cassette 'my_service', default_cassette_options, &request
else
request.proceed
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.