Home
subscribe

L'etat, c'est moi

Mere Complexities sells the consulting and development services of me, Paul Wilson.

Conferences

Organising Scotland on Rails
Speaker, RailsConf Europe '08

Archive

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.

All