Rails' Test Generation
A few weeks ago Alan Francis suggested that
The sample test case that Rails generates for models and controllers (assert true) should be created as a failure (assert false).
My badly worded comment was misunderstood. It's not how generic the test is that bothers me; I simply disagree. If rails generated broken production code then a failing test would be better. But when (for instance) you generate a model, you get a perfectly working ActiveRecord that
- works
- has ActiveRecord functionality is part of the framework and tested
- you may not want to change for a while
Under these circumstances a failing test would just be annoying. Start adding failing tests when you need to add functionality.

0 Comments:
Post a Comment
<< Home