Rails 测试中缺少记录

发布于 2024-07-25 18:44:21 字数 582 浏览 2 评论 0原文

我正在尝试使用 Cucumber/celerity 和 Factorygirl 来测试 Rails 的 Javascript。 堆栈本身可以工作,但数据库却变得疯狂。

我在 3001 端口上运行 mongrel(在 cucumber 和测试环境中都尝试过),并通过 celerity 从 cucumber 访问它。

我的其中一项测试如下:

  • 创建项目
  • 1 项目存在,
  • 对项目进行一些操作,

如果我使用简单的 webrat 界面,它就可以正常工作。

但是对于名人来说,数据库中的某些内容是错误的:

  • 创建项目#in cucumber
  • 1项目存在#in cucumber
  • 0项目存在#in celerity
  • 1项目存在#in cucumber
  • 用项目做smth #在celerity中失败,但在cucumber中工作

任何想法为什么Celerity 'ed 实例看不到黄瓜数据库中保存的内容?

PS 是的,两个实例都使用相同的数据库......

I'm trying to test Rails' Javascript with Cucumber/celerity and factorygirl. The stack itself works, but database is going crazy.

I'm running mongrel on 3001 port (tried in both cucumber and test environments) and access it from cucumber via celerity.

One of my tests looks following:

  • create item
  • 1 item exists
  • do smth with item

it works just fine if i use simple webrat interface.

but with celebrity, something in database is wrong:

  • create item #in cucumber
  • 1 item exists #in cucumber
  • 0 item exists #in celerity
  • 1 item exists #in cucumber
  • do smth with item #fails in celerity, but works in cucumber

Any ideas why Celerity'ed instance doesnt see what was saved in db in cucumber?

P.S. yes, both instance work with the same db....

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

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

发布评论

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

评论(1

临风闻羌笛 2024-08-01 18:44:21

我发现这是因为 Cucumber 封装了事务中的每一步。 把它们关掉,一切正常!

I found out that this was because Cucumber wrapped every step in transactions. Turned them off and everything works fine!

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