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

David Chelimsky dchelimsky at gmail.com
Tue Jul 13 19:02:01 EDT 2010


On Jul 13, 2010, at 5:43 PM, Jonathan Rochkind wrote:

> 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}
> end
> 
> or even:
> 
> def some_helper
>    content = ""
>    some_loop.each do |something|
>        content << render(:partial => "some/partial", :locals =>
> {:something => something}
>    end
> end
> 
> 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.

RSpec version?


More information about the rspec-users mailing list