[Rspec-users] subject.should_be true
geeksam at gmail.com
Mon Oct 16 00:01:23 EDT 2006
If :should_be is intended to be used with :foo? methods, it seems like
it should only accept booleans. Besides, :should_equal will still be
consistent with Ruby's equality semantics, right? So you'd have the
option of using either:
3.should_equal true #=> true
3.should_be true #=> false
In the first case, you're being consistent with Ruby, but in the
second, you're not only saying that something should evaluate to true,
you're actually saying "this should *be* true."
On 10/15/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> As things stand now, the following will all pass:
> true.should_be true
> "true".should_be true
> "false".should_be true
> 3.should_be true
> My feeling is that "should_be true" should only pass if it returns
> boolean true even though ruby says that non-nil/non-false is true.
> Anybody else?
> Rspec-users mailing list
> Rspec-users at rubyforge.org
More information about the Rspec-users