[Ruby] Rails view testing questions
Joe Van Dyk
joevandyk at gmail.com
Thu Sep 21 05:39:18 PDT 2006
On 9/20/06, Eric Hodel <drbrain at segment7.net> wrote:
> On Sep 19, 2006, at 12:51 PM, Joe Van Dyk wrote:
>
> > Hi,
> >
> > Using the view testing functionality of ZenTest (when's that going to
> > be incorporated into Rails, btw?),
>
> Likely never. I don't think anybody on the core team really tests.
Those bastards. Have you tried asking? (I will if you won't.)
The cool thing about the view testing is that it pushes me to identify
what data each actually view needs and giving the view (or partial)
that data through instance variables. Otherwise, I tend to get lazy
and access data more directly than I probably should.
Would be also handy if the view tests could incorporate
assert_valid_markup or assert_valid_asset somehow.
> > you can test each view and partial individually. Which is super.
> >
> > But, how can you test to see that a partial is actually being rendered
> > correctly by a view? Say I accidently delete the call to the partial
> > in the view. How could a test pick up on that?
>
> I don't know yet. There's an idea in the comments here:
>
> http://blog.segment7.net/articles/2006/09/08/render_tree-for-rails
>
> But that one is too complicated. I may do something simpler.
>
> > Also, is there a way to do something like deny_form, deny_input, etc?
>
> See deny_links_to for ideas. I haven't needed it, so I haven't
> written it (patches welcome).
More information about the Ruby
mailing list