Spork、delayed_job、email_spec 和 haml

发布于 2024-12-23 06:08:13 字数 672 浏览 1 评论 0原文

我的测试环境使用 spork &黄瓜 - 我能够很好地运行我的测试并决定包含 email_spec。但是电子邮件测试失败了

  1. 我的电子邮件是使用delayed_job发送的
  2. email_spec在检查电子邮件之前正在运行延迟作业
  3. 但是电子邮件(使用haml)没有发送出去,因为delayed_job失败了

    缺少模板 user_response_mailer/send_contact_info 和 {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=> [:zh]
    
  4. 请注意,错误中的处理程序不会在其处理程序列表中显示 :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

  1. My emails are sent out using delayed_job
  2. email_spec is running the delayed job before checking the emails
  3. 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]
    
  4. 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 技术交流群。

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

发布评论

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

评论(1

夜无邪 2024-12-30 06:08:13

这肯定是 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

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