[rspec-users] Mocking MiddleMan

Pat Maddox pergesu at gmail.com
Mon Jun 23 21:54:03 EDT 2008

On Mon, Jun 23, 2008 at 11:08 AM, s.ross <cwdinfo at gmail.com> wrote:
> I'm trying to verify (using expectations) that a backgroundrb job is being
> started. I ran across this thread:
> http://rubyforge.org/pipermail/rspec-users/2007-October/004115.html, in
> which Pat Maddox conditionally loads backgroundrb. However, I don't see why
> the original construct that started the thread doesn't work:
> MiddleMan.should_receive(:new_worker).with(whateveryourparticularargumentsare)
> What I'm observing is a failure connecting to dRuby, which makes sense if
> MiddleMan is not mocked but (to me) does not make sense when it is mocked.

>From what I remember, the problem is that backgroundrb starts some
stuff as soon as you reference MiddleMan.  So even though you're
stubbing the call to actually perform work, there's some other stuff
that goes on behind the scenes before you're even at that point.


More information about the rspec-users mailing list