= Quarry's Mocking Facility Require mock.rb library. require 'quarry/stub/mock' == Delegation Approach obj = "hello" @mck = Quarry::Mock.new @mck.upcase == "HeLLo" alt = obj.mock(@mck) lambda{ alt.upcase }.assert_raises(Assertion) obj.upcase.assert == "HELLO" == Singleton Approach obj = "hi" obj.extend(@mck) @mck.upcase == "hI" lambda{ obj.upcase }.assert_raises(Assertion) obj.remove(@mck) obj.upcase.assert == "HI" == Quick Extend Stubs obj = "hey" # implict obj.extend(obj.mock) here obj.mock.upcase == "HeY" lambda{ obj.upcase }.assert_raises(Assertion) obj.remove # imples obj.remove(obj.stub) obj.upcase.assert == "HEY" QED.