[rspec-users] Mocks: expectations vs spying

Ben Mabey ben at benmabey.com
Thu Oct 16 17:02:21 EDT 2008

Ashley Moran wrote:
> Hi again
> Ok, so I'm having a little research fling with JavaScript, and I've 
> uncovered something I hadn't seen before: "spying".  Basically, 
> inspecting mocks after-the-fact, rather than setting expectations 
> upfront.
> Here are the articles I found:
> http://ajaxian.com/archives/mockme-a-new-javascript-mocking-framework
> http://blog.johanneslink.net/2008/08/08/ajax-travelogue-part-6-mocking-in-javascript/ 
> http://blog.johanneslink.net/2008/08/09/ajax-travelogue-part-7-mockme/
> Does anyone know more about this technique, and its pros and cons vs 
> expectation-based mocking as used in RSpec mocks?
> Thanks for any info
> Ashley
Pat has been working on adding the spy pattern to rspec and JoeSniff has 
already added it to the rr mocking framework on github I believe.  There 
have been some recent posts on this mailing list about it.  Searching 
for spy in this groups past threads should give you some links to learn 
more. HTH


More information about the rspec-users mailing list