[Rails] Re: How to test the layout of a controller?
On Dec 25, 11:44 pm, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> daze wrote in post #970694:
>
> > Alright. Here's one roadblock.
> > So what I understand w/BDD is that I should write all these tests,
> > watch them fail, and then code to make the tests pass.
>
> No. Write *one* test, watch it fail, make it pass, refactor as
> necessary. Then write the next test. Lather, rinse, repeat.
Does this apply to all tests - unit, functional, etc? I got my unit
tests working, but my functionals are not.
> > But the error
> > messages I get from running tests don't provide as much insight as
> > doing "rails server" and then seeing whatever error comes up... I
> > don't understand how people do this.
>
> Probably by writing more atomic tests. Could you give an example test
> that wasn't as useful as you would have liked?
Sure. Navigating to a sections#show page yields a screen that says
"NoMethodError in SectionsController#show
undefined method `paginate' for #<Class:0x5eb4ad0>"
so I immediately realize I need to check wherever I call paginate and
see if the method is implemented.
Running the functional test
ruby -I test test/functional/sections_controller_test.rb
Only yields this:
1) Error:
test: A section should respond with 200. (SectionsControllerTest):
NoMethodError: undefined method `response_code' for nil:NilClass
This doesn't mean anything to me. (In my test, I had should
respond_with :success.)
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home