lib/minitest-vcr/spec.rb in minitest-vcr-0.0.4 vs lib/minitest-vcr/spec.rb in minitest-vcr-0.1.0
- old
+ new
@@ -1,18 +1,21 @@
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