Last active
March 28, 2017 06:22
-
-
Save daipresents/a0be49b8b20fe11460864819228ccb23 to your computer and use it in GitHub Desktop.
expect { }.not_to raise_error(SpecificErrorClass)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError), meaning the code you are intending to test may not even get reached. Instead consider using `expect {}.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment