キュウリでテストを実行していますが、実行中のテストのためにデータベースを空にしたいと考えています。これを行うように設定しましたが、テストを実行するとデータが存在します。私は何を間違っていますか?また、私はモンゴイドを使用しており、MongoDB を使用しています。
機能/サポート/env.rb:
require 'cucumber/rails'
Capybara.default_selector = :css
Dir[(Rails.root + "spec/factories/**/*.rb").to_s].each {|factory| require factory}
ActionController::Base.allow_rescue = false
begin
DatabaseCleaner.strategy = :truncation
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Cucumber::Rails::Database.javascript_strategy = :truncation
if defined?(ActiveRecord::Base)
begin
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
rescue LoadError => ignore_if_database_cleaner_not_present
end
end