Spork、delayed_job、email_spec 和 haml
我的测试环境使用 spork &黄瓜 - 我能够很好地运行我的测试并决定包含 email_spec。但是电子邮件测试失败了
- 我的电子邮件是使用delayed_job发送的
- email_spec在检查电子邮件之前正在运行延迟作业
但是电子邮件(使用haml)没有发送出去,因为delayed_job失败了
缺少模板 user_response_mailer/send_contact_info 和 {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=> [:zh]
请注意,错误中的处理程序不会在其处理程序列表中显示 :haml。我的 gemfile 中有 haml 和 haml-rails gem,并且我的应用程序在非测试环境中正确发送邮件(在 dev/prod 中没有上述错误)
主要问题是
Why is haml not getting loaded automatically when my email templates are being rendered via delayed_job running under spork ?
My testing env uses spork & cucumber - Im able to run my tests fine and decided to include email_spec. However the email tests are failing
- My emails are sent out using delayed_job
- email_spec is running the delayed job before checking the emails
However the emails (which use haml) are not getting sent out because the delayed_job is failing with
Missing template user_response_mailer/send_contact_info with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en]
Note that the handlers in the error don't show :haml in its list of handler. Ive got the haml and haml-rails gem in my gemfile and my app send out mail properly in non-test env (no such errors as above in dev/prod)
The main question is
Why is haml not getting loaded automatically when my email templates are being rendered via delayed_job running under spork ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这肯定是 spork 的问题,没有别的问题。安装 HAML 后是否重新启动了 spork 服务器?
我问这个问题是因为:我将 email_spec 与 rspec/cucumber 一起使用,现在使用 spork,并且我的应用程序中的一切都是 HAML。电子邮件是由 resque-mailer 发送的,而不是由elasque-mailer 发送的。我遇到的问题是,当使用 spork 运行时,不会拾取对 HAML 模板的更改(即 HAML 插件使用模板的预编译、缓存副本)。
查看您的错误,HAML 根本没有加载。如果是的话,:handlers 数组的列表中就会有 :haml。
就我而言,禁用视图缓存应该可以解决问题,我仍在研究这个问题
This must be a spork issue, nothing else. Have you restarted your spork server after installing HAML?
I ask because: I use email_spec with rspec/cucumber and now spork, and everything in my app is HAML. Emails are delivered by resque-mailer, not delayed_job. The issue I had was that when running with spork, changes to the HAML templates are not picked up (ie the HAML plugin uses the pre-compiled, cached copies of the templates).
Looking at your error, HAML is simply not loaded. If it was, the :handlers array would have had :haml in the list.
In my case, disabling view caching should solve the issue, I'm still poking around on that one