开发者

Ruby on Rails: test db is persisting data. I'm using Cucumber, how do I clear the DB after each scenario?

开发者 https://www.devze.com 2023-01-03 19:24 出处:网络
Preferably, I\'d like something to go in this method defined in support/env.rb After do |scenari开发者_如何学Goo|

Preferably, I'd like something to go in this method defined in support/env.rb

After do |scenari开发者_如何学Goo|
end


Add these three lines at the bottom of your env.rb

# http://github.com/bmabey/database_cleaner for more info.
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号