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
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.
Thanks, Graeme
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.
Here's what I use for RSpec: http://www.denniskuczynski.com/2012/06/22/changing-individual-test-configuration-based-on-passed-in-options.html
you can turn off transactions in cucumber env
see how to use:
https://github.com/cucumber/cucumber/wiki/Browsers-and-Transactions
Did you try using the Delayed::Worker.new.work_off approach ? Not sure it works for Devise async, but it worked for me previously for checking emails.
Using this step
Given /^Jobs are being dispatched$/ do
Delayed::Worker.new.work_off
end
And running this step before testing emails ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With