rspec-style-guide
rspec-style-guide copied to clipboard
Add a Never Check for a Bare Exception guideline
trafficstars
Taken from Effective Testing with RSpec book.
There's a matching RSpec/UnspecifiedException cop in RuboCop-RSpec.
Example problem with it.
The negated form has the opposite problem, and the exception should not be specified, as another exception may appear instead, the example will pass, and the code that is raising the exception in question won't even be run.
Worth mentioning the on_potential_false_positives config option?
https://www.andywaite.com/2018/07/15/prevent-false-positives-rspec-error.html
on_potential_false_positives with :raise is awesome 👍