[rspec-users] stubbing helper methods for View specs

David Chelimsky dchelimsky at gmail.com
Fri Jul 6 15:17:43 EDT 2007


On 7/6/07, Jens-Christian Fischer <jcfischer.lists at gmail.com> wrote:
> >>
> >> I don't have enough rspec_fu to deduce where the problem lies..
> >>
> >>
> >> Any helpers?
> >
> > In a nutshell - Rails compiles templates the first time they are
> > encountered in a given runtime. Combine this with the fact that mock
> > expectations are cleared out after every example, but the mock
> > framework doesn't have access to the compiled template, and you can
> > imagine that this is )(*&)(*ing nightmare-ish can of worms.
> >
> > I thought I had a solution for this in trunk, but I've just discovered
> > some problems with it and am working to resolve them.
> >
> > Sorry - can't be more helpful right now.
>
> so my best bet would be to use regular functional tests for the time
> being? (Having no specs/tests kind of seems to be the wrong solution
> to this problem...

Agreed that you shouldn't be without examples for this stuff, but you
have other options within rspec:

1 - use rspec controller examples in integration mode and use real
objects (almost exactly like rails functionals, except its rspec).

2 - use rspec view examples without mocking things directly on the
template. You can still mock helper methods (on controller or
helpers).

>
> :)
>
> cheers jc
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list