[rspec-devel] [ rspec-Patches-15471 ] [PATCH] " better" handling of with(:foo)

noreply at rubyforge.org noreply at rubyforge.org
Thu Nov 8 21:59:09 EST 2007


Patches item #15471, was opened at 2007-11-09 02:45
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=15471&group_id=797

Category: mock module
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Pat Maddox (pergesu)
Assigned to: Nobody (None)
Summary: [PATCH] "better" handling of with(:foo)

Initial Comment:
my_mock.should_receive(:something).with(:foo)
my_mock.something :foo
my_mock.something :bar

will blow up saying that :something was expected with :foo but received it with :bar.

In my opinion it should pass, because it was called with the supplied argument at some point.  If you want to restrict it then you should use :once.

Here's my patch (against r2831).  Let me know what you think.

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

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-11-09 02:59

Message:
This would not only break with tradition (most mock frameworks complain on the second, unexpected call) but it would also result in false positives in the cases in which people expect that call to complain.

I'm rejecting this, but if you want to open up a discussion about it on the list, feel free.

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

Comment By: Pat Maddox (pergesu)
Date: 2007-11-09 02:47

Message:
btw I put "better" in quotes because judging from the
existing specs it looks like someone might disagree with me.
 So, at the very least, I'd like to generate some discussion.

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

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


More information about the rspec-devel mailing list