数据库清理器 mongmapper 和 cucumber
#/features/support/env.rb
...
require 'database_cleaner'
require 'database_cleaner/cucumber'
require 'database_cleaner/mongo_mapper/truncation'
DatabaseCleaner.strategy = :truncation
Before do
DatabaseCleaner.start
end
After do
DatabaseCleaner.clean
end
结果
Exception encountered by DatabaseCleaner in Cucumber After block: ActiveRecord::ConnectionNotEstablished
如果我评论之前和之后块 - 测试在没有 DatabaseCleaner
ree-1.8.7-2011.03 的 情况下工作正常 导轨 (2.3.12) mongo_mapper (0.7.5) 黄瓜 (0.8.7) 黄瓜导轨 (0.3.2) 数据库清理器 (0.6.7)
#/features/support/env.rb
...
require 'database_cleaner'
require 'database_cleaner/cucumber'
require 'database_cleaner/mongo_mapper/truncation'
DatabaseCleaner.strategy = :truncation
Before do
DatabaseCleaner.start
end
After do
DatabaseCleaner.clean
end
Result
Exception encountered by DatabaseCleaner in Cucumber After block: ActiveRecord::ConnectionNotEstablished
If I comment Before and After block - tests work fine without DatabaseCleaner
ree-1.8.7-2011.03
rails (2.3.12)
mongo_mapper (0.7.5)
cucumber (0.8.7)
cucumber-rails (0.3.2)
database_cleaner (0.6.7)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来它仍在使用 ActiveRecord,请尝试禁用它
looks like it's still using ActiveRecord, try disabling it