pengwynn/octokit — pull request #187 by x3ro (2012-12-01 12:05:02+00:00)
Title: Rspec be true weirdness

Splitting up #184 into smaller chunks.

RSpec's `be_true` seems to consider everything that is not `nil` to be true ([or so they say](http://anaykamat.com/2010/05/30/rspec-matchers-be-careful-while-testing-boolean-values/)), which is why one might want to use `eq(true)` instead (?). Mentioned RSpec behavior caused it not to fail even when `remove_collaborator` returned the request object instead of a boolean (which is stated as the return type in the method comment).

I've since verified that RSpec's `be_true` implementation is counterintuitive at best:

class BeTrue < BaseMatcher
def match(_, actual)
!!actual
end

[...]

By using `!!actual`, everything but `nil` and `false` will result in a positive result. Perhaps we should suggest a `be_truthy` method to them as well @joeyw :smile: