Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Never Check for a Bare Exception guideline #105

Open
pirj opened this issue Aug 20, 2019 · 2 comments
Open

Add a Never Check for a Bare Exception guideline #105

pirj opened this issue Aug 20, 2019 · 2 comments

Comments

@pirj
Copy link
Member

pirj commented Aug 20, 2019

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.

@andyw8
Copy link
Contributor

andyw8 commented Aug 20, 2019

Worth mentioning the on_potential_false_positives config option?

https://www.andywaite.com/2018/07/15/prevent-false-positives-rspec-error.html

@pirj
Copy link
Member Author

pirj commented Aug 20, 2019

on_potential_false_positives with :raise is awesome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants