Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email_sec, delayed_job, and missing haml #87

Open
ausangshukla opened this issue Dec 28, 2011 · 5 comments
Open

email_sec, delayed_job, and missing haml #87

ausangshukla opened this issue Dec 28, 2011 · 5 comments

Comments

@ausangshukla
Copy link

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
Error Msg

Missing template user_response_mailer/send_contact_info with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en]

  1. 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 ?
@ausangshukla
Copy link
Author

Is no one using haml in their email templates and testing with email_spec ???

@kennethkalmer
Copy link

@thimmaiah 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. 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.

This issue can surely be closed, it has nothing to do with the email_spec gem.

@ausangshukla
Copy link
Author

Ive restarted and tried multiple times - no joy :(

Im at the point where Ive to abandon email_spec simply because my haml (email) templates. Im just not sure why haml is not getting loaded as Ive followed all the steps mentioned across blogs etc but....

Strangely enough the haml gem is part of the tracktrace i.e it is getting invoked in the chain (see stacktrace below /home/thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/haml-3.1.2/lib/haml/helpers/action_view_mods.rb:13) is getting invoked.

Any change you can post your cuc env.rb and other setup files( if any ) - perhaps my setup is not correct ?

Error stack trace
Missing template user_response_mailer/send_contact_info with
{:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en]}
in view paths "/home/thimmaiah/work/InAJiffy/app/views", "/home/
thimmaiah/work/InAJiffy/vendor/plugins/metamagic/app/views", "/home/
thimmaiah/work/InAJiffy/vendor/plugins/dynamic_sitemaps/app/views",
"/home/thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/devise-1.3.3/app/views
", "/home/thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/
exception_logger-0.1.10/app/views", "/home/thimmaiah/.rvm/gems/
ruby-1.9.2-p180/gems/high_voltage-0.9.4/app/views"\n/home/
thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/
action_view/paths.rb:15:in find\'\\n/home/thimmaiah/.rvm/gems/ ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/action_view/ lookup_context.rb:81:infind'\n/home/thimmaiah/.rvm/gems/ruby-1.9.2-
p180/gems/actionpack-3.0.3/lib/action_view/base.rb:186:in
find_template\'\\n/home/thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/ actionpack-3.0.3/lib/action_view/render/rendering.rb:47:in _determine_template'\n/home/thimmaiah/.rvm/gems/ruby-1.9.2-p180/
gems/actionpack-3.0.3/lib/action_view/render/rendering.rb:24:in render \'\\n/home/thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/haml-3.1.2/lib/ haml/helpers/action_view_mods.rb:13:inrender_with_haml'\n/home/
thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/
abstract_controller/rendering.rb:115:in _render_template\'\\n/home/ thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/ abstract_controller/rendering.rb:108:inrender_to_body'\n/home/
thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/
abstract_controller/rendering.rb:101:in `render_to_string'\n/home/
thimmaiah/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/

@kennethkalmer
Copy link

@thimmaiah: I'm speechless, I really have no further advice to give. I just want to confirm one last thing, have your tried disabling delayed_job & email_spec in your test environment, and then see if the mail delivers. And then switch them on/off individually ?

On my side, there is 0 configuration for email_spec/haml. I use resque/mailer and have instructed it to deliver mails directly (skipping resque) in the test environments. As far as I'm concern, pushing an email through a background stack during testing is of no use.

@ausangshukla
Copy link
Author

Kenneth - thanks for following up.

I did what you said and all views/emails are ok in the test env - no issues.

However I found this

  1. When I ran my tests with Capybara.run_server = true all the server which was started was not able to render haml templates - failing with the same error as above. Note I was testing prev with Capybara.run_server = false (with a remote server)
  2. Now Ive managed to solve this problem by commenting out require 'cucumber/rails' from my env.rb file. However I have to uncomment this line before starting spork - otherwise the rails env is not loaded and comment it out before launching cucmuber/capybara - otherwise haml is not found (yeah this is nuts)

So for the time being this seems to be the soln - but its obv that something in my setup is incorrect

If this triggers something in your memory - appreciate a shout out. And I do appreciate your help this far.

Warm Regards
T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants