Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionMailer content_type bug with 2.3 RC1

#2004

I have a bug in my specs when ActionMailer tries to render_message.


wrong number of arguments (0 for 1)
/Library/Ruby/Gems/1.8/gems/actionmailer-2.3.0/lib/action_mailer/base.rb:548:in `content_type'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.3.0/lib/action_mailer/base.rb:548:in `render_message'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.3.0/lib/action_mailer/base.rb:491:in `create!'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.3.0/lib/action_mailer/base.rb:450:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.3.0/lib/action_mailer/base.rb:393:in `new'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.3.0/lib/action_mailer/base.rb:393:in `method_missing'

method_name respond_to :content_type, but method_name.content_type return nothing (not even nil)

@@@ Ruby

  def render_message(method_name, body)
    if method_name.respond_to?(:content_type)
      @current_template_content_type = method_name.content_type  # line 548 here
    end
    render :file => method_name, :body => body
  ensure
    @current_template_content_type = nil
  end



config.action_mailer.delivery_method is set to: :test
When I comment the line 548, this bug doesn't occur anymore but specs are very slow to execute.

I use the edge version of RSpec, but this bug is present too with the last official release of RSpec (1.1.12). I don't think this is related with RSpec.

Reported by Thibaud Guillaume-Gentil · February 18th, 2009 @ 08:03 AM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Jørgen Orehøj Erichsen
    Jørgen Orehøj Erichsen

    I had the same problem. Turns out it's the problem described here:

    From http://devblog.michaelgalero.com...

    "Because when you generated the users_controller_spec.rb using the generator of the Restful Authentication plugin, the comment said you should move the include AuthenticatedTestHelper to spec_helper.rb. And you did. And the AuthenticatedTestHelper module defines a content_type method with 1 argument that gets added to the Object class."

    February 18th, 2009 @ 08:45 PM

  2. Thibaud Guillaume-Gentil
    Thibaud Guillaume-Gentil

    Great removing AuthenticatedTestHelper fix the problem, thank Jørgen!

    But now, my specs are quite slower each time that a email is delivered, any ideas why?

    February 19th, 2009 @ 08:09 AM

  3. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to invalid

    April 22nd, 2009 @ 10:14 PM

  4. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 9th, 2010 @ 10:00 PM