We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

narkisr on 06/22/08


Tagged

ruby Mocking


Versions (?)


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.