Sha256: 8b288173c4572c9ef4a0bd75ecbf141294e090b0fe6a7cc2cf221382133532cd

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

require "vcr"
require "minispec-metadata"

module MinitestVcr
  module Spec

    def self.configure!
      run_before = lambda do |example|
        if metadata[:vcr]
          test_info = example.class.name.split("::::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?)
          VCR.insert_cassette 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.1 lib/minitest-vcr/spec.rb