class Shoulda::Matchers::Doublespeak::Double
def replace_method_with_double
def replace_method_with_double double = self implementation = @implementation _method_name = method_name if klass.instance_methods(false).include?(method_name) klass.__send__(:remove_method, method_name) end klass.__send__(:define_method, method_name) do |*args, &block| call = MethodCall.new( double: double, object: self, method_name: _method_name, args: args, block: block, caller: caller ) implementation.call(call) end end