【发布时间】:2011-04-28 22:13:35
【问题描述】:
我正在启动一个新应用程序,并注意到我上次从头开始构建 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
【问题讨论】:
标签: ruby-on-rails rspec mongoid