[rspec-users] Helpers in view specs

David Chelimsky dchelimsky at gmail.com
Sun Feb 17 12:40:31 EST 2008


On Feb 17, 2008 11:17 AM, Steve <vertebrate at gmail.com> wrote:
> On Sun, 17 Feb 2008 08:06:10 -0500, David Chelimsky wrote:
>
> > On Feb 17, 2008 1:08 AM, Steve
> > <vertebrate at gmail.com> wrote:
> >> I'm not sure of what the community stance is on this, but is there a
> >> builtin way to include helpers in view specs? Is this practice shunned?
> >> My thoughts on the matter are that I expect my views to have a specific
> >> output, and sometimes it would be much easier to call the helper
> >> function in the view spec, so that that output could be expected. My
> >> helper functions all have their own specs, so it would seem that I'm
> >> not doing anything magical, just making the specs a little simpler.
> >
> > http://rspec.info/rdoc-rails/classes/Spec/Rails/Example/
> ViewExampleGroup.html#M000037
> >
>
> I think that's showing a way of maybe overriding existing helpers in the
> view? What I'm asking is more like this:
>
> http://pastie.caboo.se/153392
>
> In the example I actually have "include ApplicationHelper" in there, and
> am using a method "row_class_for_idx" in the spec. It works. I'm just
> wondering if that's bad form or not.

You may want to give this a read:
http://blog.jayfields.com/2008/02/testing-expect-literals.html.

Please do write back here if you do and let us know what you think.

Cheers,
David

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


More information about the rspec-users mailing list