I generally write something like this in my Rspec tests:
user.new(...)
user.should be_valid
The problem is, when that test fails, I don’t get to see the errors on the user object. Is there a nice way to re-write this test so that in the Rspec output I’ll see something like user.errors.inspect? I’ve tried user.errors.should be_empty, but that still just says “expected true, got false.”
You can do this by defining a custom matcher. Something like this should do the trick.