Read more

RSpec claims nil to be false

Arne Hartherz
June 29, 2012Software engineer at makandra GmbH

RSpec's be_false behaves unexpectedly:

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

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

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

nil.should == false
# fails as expected

Wat? Show archive.org snapshot

See also

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

Posted by Arne Hartherz to makandra dev (2012-06-29 12:19)