RSpec claims nil to be false

RSpec's be_false behaves unexpectedly:

nil.should be_false
# passes, as the expectation returns true

If you want to check for false, you need to do it like this:

nil.should == false
# fails as expected

Wat? Archive

See also

RSpec: be_true does not actually check if a value is true

Arne Hartherz about 10 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more