Saturday, April 13, 2013

[Rails] Testing a helper that uses content_for

Hey guys, I'm having trouble testing a helper that uses content_for. I am using test::unit and hitting a road block. below is my code and below that is the error I am hitting. Any help would be much appreciated.

Matt

-- my helper def --
def page_title(title)
content_for(:title) { "#{title} | my title" }
end


-- my test --
test "displays page title" do
assert_equal "my test | my title", page_title("my test")
end

NoMethodError: undefined method `append' for nil:NilClass

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate