[rspec-users] What to test for views?

Andrew WC Brown omen.king at gmail.com
Sun Dec 9 23:58:34 EST 2007

I think what David said before about spec views is take it with a grain of
If you think you need to check the presence of every field go ahead.

When I spec out my views I only spec what needs to be there:

I won't check for the presence of a form fields new.rhtml_spec.rb
I would place my fields in a partial called fields and I spec their presence
in _fields.html_spec.rb
I would spec in my new.rhtml_spec.rb if the partial fields was rendered.

It may satisfy you just to have a spec that says:

it "should show form" do

Its all up to you how granular you want to get.

On Dec 9, 2007 3:58 PM, Chris Olsen <lists at ruby-forum.com> wrote:

> When you guys test views, what are you testing? Do you just test that
> all the form fields exist in a new.rhtml, that all form fields are
> filled in an edit.rhtml, and that all the proper columns are are shown
> in a index.rhtml page, or is there something more that should be tested?
> Thanks.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071209/0755b276/attachment.html 

More information about the rspec-users mailing list