ccspec icon indicating copy to clipboard operation
ccspec copied to clipboard

Support `expect(val).to(be(bool))` syntax

Open zhangsu opened this issue 10 years ago • 0 comments

Sometimes it's more readable to say

expect(...).to(be(true))
expect(...).to(be(false))

than to say

expect(...).to(be_truthy)
expect(...).to(be_falsey)

When we are sure that the subject must be true (1) or false (0), we should be able to use the be(true) and be(false) syntax to match the exact value, instead of matching non-zero for "truthy" and zero for "falsey". We should be able to do this by overloading the Be#match template method with boolean parameter type.

zhangsu avatar Oct 31 '15 16:10 zhangsu