DEV Community

Discussion on: Assertions of Truth in Ruby Tests

Collapse
 
baweaver profile image
Brandon Weaver

It's a good idea, because in a lot of Ruby things only have to be "Boolean-like" rather than actually true and false.

In fact there's been a bit of an ongoing debate in the Rails codebase between the two and it can be quite confusing, as one in-particular that presents as Boolean by name can return 0. While that's truthy in Ruby it still creates confusion, even if it is an index position, because of the way the method is presented as boolean.