[rspec-users] spec for a rails helper that renders a partial template

Jonathan Rochkind lists at ruby-forum.com
Tue Jul 13 18:43:59 EDT 2010

So the stock answer to this is "don't do it".  But I'm in a situation
where it's really what I want to do to test what I want to test.

a helper method:

def some_helper
   render(:partial => "some/partial", :locals => {:some => some}

or even:

def some_helper
    content = ""
    some_loop.each do |something|
        content << render(:partial => "some/partial", :locals =>
{:something => something}

Is there any way to write a spec where I can test this kind of helper,
and it really will render it's partial(s), and I can really write specs
against the return strings?

Any way at all? I've been trying for a while with no success. Thanks for
any advice.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list