Method: Mocha::ClassMethod#restore_original_method

Defined in:
lib/mocha/class_method.rb

#restore_original_methodObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/mocha/class_method.rb', line 51

def restore_original_method
  if method_exists?(hidden_method)
    begin
      stubbee.__metaclass__.send(:alias_method, method, hidden_method)
      stubbee.__metaclass__.send(:remove_method, hidden_method)
    rescue NameError
      # deal with nasties like ActiveRecord::Associations::AssociationProxy
    end
  end
end