[rspec-users] Bug in should_not_be - What else to use?
dchelimsky at gmail.com
Sun Jan 28 21:33:07 EST 2007
On 1/28/07, Tobi <listaccount at e-tobi.net> wrote:
> I just stumbled over a possible bug in 0.7.5.1:
> `1.should_not_be == 1` does not fail.
Try should_not == 1
> I took a look into the code and figured out, that this is caused by
> Not.be() using :no_arg instead of :___no_arg. The expected argument of
> the method be() in Not is passed from should_not_be() with :___no_arg.
> Not.be() is marked with "Gone for 0.9", so I assume that "should_not_be
> ==" shouldn't be used at all, right? So what else to use, when testing
> of "==" is required?
> 1.should_not == 1
> ...gives a "not so nice" failure message: "1 should not == 1 nil" - this
> would read nicer as "1 should not be == 1"
> Where is the "nil" in the failure message coming from anyway? I digged a
> little bit deeper into the sources and figured that out too:
> In the Not class, instead of passing the not expected value as the
> second argument to default_message, it gets appended to the message text,
> so the missing argument will then be added by default_message() as nil.
> I've already added a bug report.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users