46
For RSpec 3+:
The message could be customized as a string or using a proc(check the reference).
expect(1).to eq(2), 'one is not two!'
Customized message RSpec tries to provide useful failure messages, but for cases in which you want more specific information, you can define your own message right in the example. This works for any matcher other than the operator matchers.
For older RSpec versions
should and should_not take a second argument (message) that overrides the matcher’s default message.
1.should be(2), 'one is not two!'
The default messages are usually pretty useful though.