Always specify the exception in RSpec
This week-end I’ve upgraded all tests (1000+) in one of my projects from old RSpec 2.14 to RSpec 3.4. I did this according to RSpec site. It went all good - except for CarrierWave tests, which relies on a deprecated protocol.
A deprecation warning I’ve also encountered is this one
To be quite honest, I’ve never really thought about that but it’s obvious that this advice is wise. So wise that when searching for code not specifying an error and adding one, I’ve stumbled upon that kind of error:
So indeed I was fooled by my test - by my reasoning about it I should say: it passed but it did so for the wrong reason. I thought it was ok but it really wasn’t.
So, the end of the story is: always specify exception when using raise_exception()
matcher.