[rspec-users] Failure Messages in RSpec
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users