Skip to content

Instantly share code, notes, and snippets.

@thibaudgg
Forked from myronmarston/yaml_test.rb
Created June 30, 2010 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thibaudgg/458355 to your computer and use it in GitHub Desktop.
Save thibaudgg/458355 to your computer and use it in GitHub Desktop.
---
- !ruby/struct:VCR::HTTPInteraction
response: !ruby/struct:VCR::Response
body: &id002 !str
str: ""
"@net_http_res": !ruby/object:Net::HTTPOK
body: *id002
# We want to use YAML without VCR loaded, to isolate our testing to just YAML.
# However, the yaml files reference some VCR types, so we have to load them.
# Alternately, you can just copy the VCR struct definitions from:
# http://github.com/myronmarston/vcr/blob/v1.0.0/lib/vcr/structs.rb
$LOAD_PATH.unshift('path/to/vcr/lib/dir')
require 'vcr/structs'
times = 1000 # do this many times to expose any intermittent YAML errors
dir = 'path/to/vcr/cassettes'
case ENV['YAML']
when 'rbyaml'
require 'rubygems'
require 'RbYAML'
def load_yaml(content)
RbYAML.load(content)
end
else
require 'yaml'
def load_yaml(content)
YAML.load(content)
end
end
times.times do |i|
Dir.glob("#{dir}/**/*.yml").each do |file|
content = File.read(file)
load_yaml(content)
puts file
end
puts "\n\n#{i}\n\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment