RSpec Matchers: Be careful while testing boolean values
Posted by Anay on May 30, 2010
1 comment
While testing methods that return boolean values in ruby (the ones that end in ‘?’), try to avoid following matchers: method_returning_true?.should be_true or method_returning_false?should be_false This is because, ‘be_true’ and ‘be_false’ matchers considers ‘nil’ to be false and anything other than ‘nil’ to be true. When we write methods in ruby which end with question [...]