Displaying 1 result from an estimated 1 matches for "define_new_method".
2007 Jan 11
4
counter-intuitive behaveour when passing a proc to Mocha::Expectation#returns
...:
stubs( :save ). returns( lambda { eval "len" } )
Unfortunately this doesn''t work, since the "stubs" method doesn''t at all take
parameter names into account. As far as I can see, this is the place where the
actual method replacement is being done:
def define_new_method
stubbee.metaclass.class_eval "def #{method}(*args, &block)
mocha.method_missing(:#{method}, *args, &block); end"
end
and it just passes all the arguments as an array. I''m not suggesting the fix for
the problem at hand is trivial - I can''t see at a g...