Posted about 10 years ago. Visible to the public.

RSpec claims nil to be false

RSpec's be_false behaves unexpectedly:

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

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

Copy
nil.should == false # fails as expected

Wat? Archive

See also

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

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Avatar
Arne Hartherz
Last edit:
over 6 years ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more