Posted By

narkisr on 06/22/08


ruby Mocking

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Simple mocking of Ruby objects

 / Published in: Ruby

This is as simple as it gets, basiclly this templates shows you how to mock an object methods to any other piece of code that you like (open objects at its simplest glory).

  1. class << to_be_mocked
  2. def mocked_method
  3. # code
  4. end
  5. end

Report this snippet  

You need to login to post a comment.