Sha256: 5542a8491cd55953b8d42c8cdc179182a5f8678859a559a3337a6b6df01047ac

Contents?: true

Size: 668 Bytes

Versions: 2

Compression:

Stored size: 668 Bytes

Contents

require "vcr"
require "minispec-metadata"
require "extensions/string"
require "database_cleaner"

module MinitestVcr
  module Spec

    def self.configure!
      run_before = lambda do |example|
        DatabaseCleaner.start rescue DatabaseCleaner::NoORMDetected
        VCR.insert_cassette example.class.name.vcr_path(example, spec_name) if metadata[:vcr]
      end

      run_after = lambda do |example|
        ::VCR.eject_cassette if metadata[:vcr]
        DatabaseCleaner.clean rescue DatabaseCleaner::NoORMDetected
      end

      ::MiniTest::Spec.before :each, &run_before
      ::MiniTest::Spec.after :each, &run_after
    end

  end # Spec
end # MinitestVcr

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minitest-vcr-0.1.1 lib/minitest-vcr/spec.rb
minitest-vcr-0.1.0 lib/minitest-vcr/spec.rb