我正在开始一个新的应用程序,并注意到我上次从头开始构建MongoID应用程序时缺少一些文档.也就是说,他们曾经在一个不再存在的页面上建议(
http://mongoid.org/docs/integration/)包含一些代码来删除MongoID的集合(在测试之后).
它现在不再在网站上提到了…这个(下面的****)不再被视为必要或良好的做法了吗?!?
#spec/spec_helper.rb: ... RSpec.configure do |config| config.mock_with :rspec # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures #config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord,or you'd prefer not to run each of your # examples within a transaction,remove the following line or assign false # instead of true. #config.use_transactional_fixtures = true # Below from <http://mongoid.org/docs/integration/> **** config.after :suite do Mongoid.master.collections.select do |collection| collection.name !~ /system/ end.each(&:drop) end end