[rspec-users] be_true and be_false

David Chelimsky dchelimsky at gmail.com
Mon Dec 28 14:12:12 EST 2009


On Mon, Dec 28, 2009 at 1:04 PM, David Chelimsky <dchelimsky at gmail.com>wrote:

> Hi all,
>
> The be_true and be_false matchers pass if the actual object is the
> singleton instance of true or false respectively. e.g.
>
> true.should be_true # passes
> 1.should be_true # fails
>

Actually, "1.should be_true" passes, but based on the current spec it
shouldn't :)


> "true".should be_true #fails
>
> false.should be_false # passes
> nil.should be_false # fails
>
> http://rspec.lighthouseapp.com/projects/5645/tickets/931 suggests that
> be_true should pass for anything that Ruby would evaluate as true (i.e.
> anything but false or nil) and be_false would pass for anything that Ruby
> would evaluate as false (i.e. false or nil).
>
> Please comment _in that ticket_ if you have an opinion about this.
>
> Cheers,
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091228/b0690612/attachment.html>


More information about the rspec-users mailing list