📜  rails rspec 在每次测试后销毁数据 - Ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:49.257000             🧑  作者: Mango

代码示例1
config.before(:suite) do
  DatabaseCleaner.strategy = :transaction
  DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do
  DatabaseCleaner.start
end

config.after(:each) do
  DatabaseCleaner.clean
end