Displaying 2 results from an estimated 2 matches for "stubba_method".
Did you mean:
stub_method
2007 Aug 08
1
Mocking Time, delegating to original object
...stubbing :delegates
end
class Delegator
def initialize expectation
@expectation = expectation
end
def evaluate
@expectation.mock.stub_method.stubbee.send(@expectation.mock.stub_method.hidden_method)
end
end
end
class Object
def expects(symbol)
method = stubba_method.new(stubba_object, symbol)
$stubba.stub(method)
mocha.expects(symbol, caller, method)
end
def stubs(symbol)
method = stubba_method.new(stubba_object, symbol)
$stubba.stub(method)
mocha.stubs(symbol, caller, method)
end
end
Haven''t tested this with anything oth...
2007 Mar 04
4
Rails functional testing and Mocha
...end
Lastly we define an implementation of after_find that causes the
expectations to be set as the objects are loaded
module Mocha
module ExpectationLoader
def after_find
if any = self.class.any_instance_with_id( self.id)
any.expectations.each do |e|
method = stubba_method.new(stubba_object, e.method_name)
$stubba.stub(method)
e.mock = self.mocha
self.mocha.expectations << e
self.mocha.__metaclass__.send(:undef_method,
e.method_name) if self.mocha.__metaclass__.method_defined?
(e.method_name)
end
en...