Last active
January 19, 2017 22:39
-
-
Save sirwolfgang/34bf202f4e084f8ce5f5 to your computer and use it in GitHub Desktop.
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
RSpec.configure do |config| | |
# Add VCR to all tests | |
config.around(:each) do |example| | |
options = example.metadata[:vcr] || {} | |
if options[:record] == :skip | |
VCR.turned_off(&example) | |
else | |
name = example | |
.metadata[:full_description] | |
.split(/\s+/, 2) | |
.join('/') | |
.underscore | |
.strip | |
.gsub('!', '_bang') | |
.gsub(/[\.#]/, '/') | |
.gsub(%r([^\w/]+), '_') | |
.gsub(%(/$), '') | |
.gsub('_/', '/') | |
VCR.use_cassette(name, options, &example) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment