[Rspec-users] mock parameter problem

Micah Martin micah at 8thlight.com
Tue Oct 24 23:08:22 EDT 2006

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

Perhaps existing mock frameworks already have elegant terminology  
that could be referenced.

I'll submit an RFE as soon as I figure out how.

Micah Martin
8th Light, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061024/fe07aa2d/attachment.html 

More information about the Rspec-users mailing list