[mocha-developer] with-arguments block is executed regardless of method?

Jonathan del Strother jon.delStrother at bestbefore.tv
Thu Feb 1 09:11:08 EST 2007


I have a test case where I'm stubbing one method ('jobs'), and  
mocking another ('new_worker')

MiddleMan.stubs(:jobs)
MiddleMan.expects(:new_worker).with{|args| args[:class] 
==:download_worker}
MiddleMan.jobs()


The above code results in an error ("The error occurred while  
evaluating nil.[]") - calling 'jobs' results in the with-arguments  
block for new_worker getting executed.
Is this intended behaviour?

Jon


More information about the mocha-developer mailing list