导轨中的多个夹具组?

发布于 2024-12-12 04:28:48 字数 229 浏览 9 评论 0原文

有没有办法为 Rails 测试提供不同的夹具集(您可能称之为“夹具配置文件”)?

我发现的最好的插件是 2006 年的 Rails 1.3 插件。我以为这样的东西会有更多的需求。就我而言,我想要一个“离线”配置文件,其中包括所有数据的缓存,以及另一个获取数据所需的“在线”配置文件。

Is there a way to have different fixture sets (what you might call a "fixture profile") for Rails tests?

The best I've found is a Rails 1.3 plugin from 2006. I thought there'd be more demand for this kind of thing. In my case, I want an "offline" profile which would include a cache of all data, and another "online" profile which would be required to fetch data.

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

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

发布评论

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

评论(1

手长情犹 2024-12-19 04:28:48

Since no-one's answered, I'll say that the best solution here seems to be Factory Girl. It's not built-in Rails fixtures, but it's really an enhanced version of fixtures, and one which supports the use case in this question. The problem with fixtures is they closely tie the fixture file to the class. But with factory girl, you can have as many factory definitions as you like.

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