[rspec-users] strange error on mock proxy

Jeroen Houben jeroen.houben at lostboys.nl
Mon Dec 10 13:25:09 EST 2007

On 12/10/07 6:55 PM, "David Chelimsky" <dchelimsky at gmail.com> wrote:

> On Dec 10, 2007 11:42 AM, Brandon Keepers <brandon at collectiveidea.com> wrote:
>> David,
>> Did you ever get a chance to look at this to see if I am missing
>> something obvious.  I'm getting these errors randomly.
> Haven't yet. Anybody else on this list having a similar experience?

I've also been getting very confused with specs failing with rake:spec but
passing when running focused examples (e.g.from textmate). This is without
fixtures but using mocks. It's as if the mocks were somehow remembering the
should_receive declarations between specs. They didn't seem to get updated.

Turned out I made a mistake a using partial mocks namely trying to set
should_receive on the real object instead of the mock.  This mistakes
somehow only became apparent when running with rake:spec.

I'm using flexmock 0.8, rspec plugin 1.08 with rails 1.2.6

I'm pretty sure I still get some failures in a rake:spec but not in
isolation, I'll post examples when I run into them again


P.s. I had to read this bit a few times before understanding partial mocking
with flexmock:

"If you you give flexmock a real object in the argument list, it will treat
that real object as a base for a partial mock object. The return value m may
be used to set expectations. The real_object should be used in the reference
portion of the test."


More information about the rspec-users mailing list