[Rspec-users] Fwd: mock parameter problem
dchelimsky at gmail.com
Wed Oct 25 00:00:25 EDT 2006
On 10/24/06, Micah Martin <micah at 8thlight.com> wrote:
> Here's another one.
> m = mock("blah")
> Failure message:
> Mock 'blah' expected 'foo' once, but received it 0 times
> Twice now I've gotten this failure message and wasted time trying to
> understand why the method foo() was not being called despite all evidence
> suggesting that it was being called. The problem is that rSpec is lying to
> me. foo() is being called. The parameter is not what's expected, but foo()
> is being called.
> I'm not sure how fancy you guys want to get with the failure messages, but
> more information is needed. Maybe:
> Mock 'blah' expected 'foo(1)' once, but received it 0 times
> Mock 'blah' expected 'foo' once with 1, but received it 1 time with 2
> or to avoid the problem printing unknown parameters
> Mock 'blah' expected 'foo' with one parameter, but received it 1 time with
> the wrong parameter
This is actually fixed in the trunk. So now if you do this:
You'll get this:
Mock 'blah' expected :foo with [:arg] once, and received it 0 times.
> Perhaps existing mock frameworks already have elegant terminology that could
> be referenced.
> I'll submit an RFE as soon as I figure out how.
To raise RFE (Request for Enhancement):
1. go to http://rubyforge.org/tracker/?atid=3152&group_id=797&func=browse
2. Click "Submit New"
The rest should be self explanatory.
Thanks for pointing these things out, and thanks for using our mock framework!
> Micah Martin
> 8th Light, Inc.
> Rspec-users mailing list
> Rspec-users at rubyforge.org
More information about the Rspec-users