如何使 Rails 测试装置在测试之间保持不变?

发布于 2024-08-26 01:59:27 字数 148 浏览 2 评论 0原文

我的 Rails 测试套件中有六个固定装置(其中一些相当大),它们代表数据库中的静态查找表。由于它们的值理论上不会改变,因此我想节省每次测试之间擦除和重新加载表的时间。是否有一个技巧/插件/宝石/黑客来将这些固定装置划分为只需要在所有测试运行之前加载一次,而不是在每个测试之间擦除?

I have a good half-dozen fixtures in my Rails test suite - some quite large - that represent static look-up tables in the database. Since their values theoretically don't change, I'd like to save the time of wiping and reloading the tables between each test. Is there a trick/plug-in/gem/hack to demarcate these fixtures as only needing to be loaded once before all the tests run and not wiped between each?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

呆头 2024-09-02 01:59:27

您可以在所有测试中停用回滚事务。

或者您可以在所有测试之前添加此装置。交易开始前。

You can desactivate rollback transaction in all your test.

Or you can add this fixtures before all of your test. Before the begin of transaction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文