PDA

View Full Version : undefined method `render' thrown in helper test


clem_c_rock
April 3rd, 2007, 04:33 PM
Hello,

I'm trying to write a very simple test for a very simple method in a helper_test.

Here's the method I'm testing in my_helper.rb:


def subscribe_email_link
if @subscription_model_class
render(:partial => '/subscription/toggle')
end
end


And in my_helper_test.rb

I'm trying:


def test_subscribe_email_link
@subscription_model_class = true
link = subscribe_email_link
end


The link = subscribe_email_link section throws a "undefined method `render' " error

Is there a way I can add render functionality in this helper test?

Thanks for your time.

rob
April 4th, 2007, 02:39 AM
I think render is going out of scope in the helper.

Try replacing render with ActionController::Base.render to bring it into scope.