如何让 devise_async 与 Cucumber 一起工作? [英] How do I get devise_async working with Cucumber?
问题描述
我已按照 README 遵循了 devise_async 的说明,我正在滚动 Devise2.1.2 和延迟工作.在我的黄瓜测试中,作为注册过程的一部分,我不再收到确认电子邮件.作为测试的一部分,我应该做些什么吗?我已经通过在我的测试环境中设置以下内容来设置延迟作业以跳过测试的实际延迟.
I've followed the instructions for devise_async as per the README and I'm rolling Devise 2.1.2 and delayed_job. In my cucumber tests, I no longer receive the confirmation email as part of the sign-up process. Is there something I should be doing as part of testing? I already set delayed job to skip the actual delay for testing by setting the following in my test environment.
Delayed::Worker.delay_jobs = false
但即使设置为 true,它仍然会失败,尽管速度会更慢.如果我删除 devise_async gem 和相关行,一切都会重新焕发生机.
But even with this set to true, it still fails, albeit more slowly. If I remove the devise_async gem and the relevant lines, everything bursts back into life.
谢谢,格雷姆
推荐答案
新版devise-async在记录提交到数据库后触发email.使用 RSpec,默认情况下每个测试都包装在一个事务中.黄瓜也一样吗?在这种情况下,您需要关闭这些测试事务.
The new version of devise-async triggers the emails after the record has been committed to the database. With RSpec, each test is wrapped in a transaction by default. Does Cucumber do the same? In that case you'll need to turn those test transactions off.
这是我用于 RSpec 的内容:http:///www.denniskuczynski.com/2012/06/22/changeing-individual-test-configuration-based-on-passed-in-options.html
Here's what I use for RSpec: http://www.denniskuczynski.com/2012/06/22/changing-individual-test-configuration-based-on-passed-in-options.html
这篇关于如何让 devise_async 与 Cucumber 一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!