运行几次后,rails 测试数据库未清除 [英] rails test database not clearing after some runs

查看:29
本文介绍了运行几次后,rails 测试数据库未清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 rspec 进行测试,我注意到在运行测试后,它有时会在测试数据库中留下一些记录.我不知道为什么.我在我的配置文件中将 use_transactional_fixtures 设置为 true.但是直到我手动删除记录它们才会消失.有没有人有办法阻止这种情况?

I am using rspec to test and I notice that after running the tests, it sometimes leaves some records in the test database. I'm not sure why. I have use_transactional_fixtures set to true in my config file. But they don't go away until I manually delete the records. Does anyone have a way to stop this?

编辑;在我说只有当测试失败时.这不再是真的.

EDIT; before i said it was only when tests fail. that's no longer true.

推荐答案

我发现了问题.Before(:all) 块不是事务性的

这篇关于运行几次后,rails 测试数据库未清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆