[rspec-users] Test that controller includes helpers?

David Chelimsky dchelimsky at gmail.com
Sat Nov 3 02:00:56 EDT 2007


On Nov 2, 2007 5:59 PM, Steve <vertebrate at gmail.com> wrote:
> Is there an easy way to spec that a controller should include helpers
> other than its own? I was thinking I could just spec responds_to for
> methods I'm interested in in the view, but that seems like crossing a
> separation boundary, that the controller maybe doesn't need to know about?

FWIW, by asking you to declare helpers in controllers so that views
can access their goodness, Rails is already forcing you to cross that
boundary. So whatever you do here is a compromise and you just need to
find the lesser of evils.

I think the most pragmatic thing to do would be to use a controller
spec with integrate_views and describe what the view should look like
when it uses one of the included methods. Alternatively could load the
file and expect the declaration (but that's somewhat controversial on
this list).

HTH,
David


More information about the rspec-users mailing list