[rspec-devel] [ rspec-Bugs-13760 ] False Positives on eql?()

noreply at rubyforge.org noreply at rubyforge.org
Fri Sep 7 23:03:02 EDT 2007


Bugs item #13760, was opened at 2007-09-07 19:15
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13760&group_id=797

Category: expectation module
Group: None
Status: Open
Resolution: Accepted
Priority: 3
Submitted By: Geoffrey Wiseman (diathesis)
Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: False Positives on eql?()

Initial Comment:
I accidentally typed:
  ob.should eql?(something)

This passed incorrectly.  It seems to be that I've essentially compared the 'something' value to the behavior object, and generated a false; by way of example, this also passes:
  ob.should false

Both of these are presumably dangerous false positives, particularly the former that's one keystroke away from the valid approach, and in keeping with eql? elsewhere, so it's an easy mistake to make.

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-09-08 03:03

Message:
I just committed a partial fix for this (r2532). If the matcher receives anything besides nil, it'll work was you expect (w/ an InvalidArgument error). I want to solve for nil before I close this, but the slam dunk I was expecting eluded me.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-09-08 00:15

Message:
should and should_not both take a matcher (an object that responds to matches?). If no matcher is passed, it handles operators (should == expected).

In the case of handling operators, nothing gets passed to should. My thinking is that if anything besides a matcher is passed to should, it should raise an InvalidArgument error.

WDYT?

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-09-07 22:32

Message:
Sorry, my bad - I just saw that you actually had posted on the list first, and having read the mail I understand what you mean.

How would you like RSpec to behave in the situation you describe? Can you describe that with a (failing) spec?

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-09-07 22:26

Message:
I don't understand what you mean, nor is there any complete code here I can execute to reproduce what you say is a bug.

Please submit some more complete code on the mailing list to make sure what you're talking about is a bug or not.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13760&group_id=797


More information about the rspec-devel mailing list