[rspec-users] Missing template in helper specs with a render

Craig Demyanovich cdemyanovich at gmail.com
Tue Aug 24 09:26:28 EDT 2010


On Tue, Aug 24, 2010 at 5:19 AM, Alex Pressberg <lists at ruby-forum.com>wrote:

> Yes! We do use render in helpers to a great extent and are bitten by the
> "missing template in view path" error too. Any workarounds? Can the view
> path be easily fixed for helper specs in Rspec 1.3?
> Does Rspec 2 already support this?
>

If you're doing it, it's obviously possible, but it feels wrong to me. I
think of a helper as a small piece of code that helps me decide what to
render, gives me a CSS class name based on some condition, gives me a small
chunk of markup whose generation would clutter up the view, etc. Have you
considered that, though the framework allows you to do this, it may not be a
good approach? In other words, instead of looking for a workaround, would it
make more sense (at least in the long term) to change your application?

I'm sorry I can't offer actual help w/ current tools. I'm curious if Rails 3
still supports this or if RSpec 2 will support it.

Regards,
Craig



> David Chelimsky wrote:
> > On Thu, Jun 4, 2009 at 8:41 PM, Charlie Bowman
> > <charlesmbowman at gmail.com> wrote:
> >> I have a helper method that does a "render :partial".� The method works
> fine
> >> within the app (Rails 2.3.2).� In rspec (1.2.6) I get an error ("Missing
> >> template /comments/_comment.erb in view path"
> >> It seems that rspec when running helper tests doesn't set the view_path
> so
> >> rails doens't know where to look for the templates.� Is there a way to
> run
> >> helper specs with the same setup as controller specs?
> >
> > There is no support for rendering in helper specs as of yet. Please
> > file a feature request if you think there should be. I have,
> > personally, never rendered from a helper. Anybody else?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100824/75ef3d38/attachment-0001.html>


More information about the rspec-users mailing list