[rspec-users] Failure Messages in RSpec

Geoffrey Wiseman geoffrey.wiseman at gmail.com
Tue Sep 4 13:21:55 EDT 2007

Having used JUnit and Test::Unit, I'm quite used to having the ability to
insert a failure message, which helps when tests fail.

For instance, the example RSpec that is generated for a model class
specifies that the model class is valid.  Assuming this were supposed to be
true, and it failed, I've now got to duplicate the code in the test in order
to find out why it wasn't valid.

Whereas if I were writing the same code in Test::Unit, I might write:
  assert model.valid?, "Expected model to be valid, but found these errors:

This means that when the model validation fails, I know /why/.  I don't see
an easy way to include these sorts of messages in RSpec, which seems likely
to cause me to waste time on test failures.  Am I missing something?  How
are experienced RSpec users resolving this?


  - Geoffrey
Geoffrey Wiseman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070904/558bcc38/attachment.html 

More information about the rspec-users mailing list