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/.
I think what David said before about spec views is take it with a grain of salt. 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 response.shouldhave_tag("form[action=#{projects_path(@game)}][method=post]") end 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
I first started to check things existence in the resulting page but quickly decided to only check for permission-affected links, forms, etc. Though if your applications are RESTful it would be good idea to check http method form uses and hidden fields that Rails uses to piggyback PUT and DELETE on top of POST. On 9 ???. 2007, at 22:58, Chris Olsen 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?MK