Sha256: f33a5b487f80d1f62b822b2f19cc121c5047f1fb8180efee82367b456cc3e78c
Contents?: true
Size: 981 Bytes
Versions: 1
Compression:
Stored size: 981 Bytes
Contents
require "vcr" require "minispec-metadata" module MinitestVcr module Spec def self.configure! run_before = lambda do |example| if metadata[:vcr] example.class.name.scan(/^(.*?)::[abc]/) do |name| @class_name = name.first end if @class_name.nil? test_info = example.class.name.split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"] @class_name = "" else test_info = example.class.name.gsub(@class_name, "").split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"] end VCR.insert_cassette @class_name + "/" + test_info.join("/") + "/#{spec_name}" end end run_after = lambda do |example| if metadata[:vcr] ::VCR.eject_cassette end end ::MiniTest::Spec.before :each, &run_before ::MiniTest::Spec.after :each, &run_after end end # Spec end # MinitestVcr
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
minitest-vcr-0.0.2 | lib/minitest-vcr/spec.rb |