Мне нужно настроить очистку mongoid для каждой спецификации.Какой правильный метод для вызова Rspec.configure при использовании spork?prefork или each_run?
Вот мои текущие настройки:
require 'rubygems'
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
require File.dirname(__FILE__) + '/../config/environment.rb'
require 'rspec'
require 'rspec/rails'
RSpec.configure do |config|
config.mock_with :rspec
config.after(:each) do
puts "cleaning mongodb...."
Mongoid.database.collections.each do |collection|
unless collection.name =~ /^system\./
collection.remove
end
end
puts "finished cleaning mongodb."
end
end
end
Spork.each_run do
end