Class: Mocha::ModuleMethod

Inherits:
ClassMethod show all
Defined in:
lib/mocha/module_method.rb

Instance Attribute Summary

Attributes inherited from ClassMethod

#method, #stubbee

Instance Method Summary collapse

Methods inherited from ClassMethod

#define_new_method, #hide_original_method, #initialize, #matches?, #mock, #remove_new_method, #reset_mocha, #restore_original_method, #stub, #to_s, #unstub

Constructor Details

This class inherits a constructor from Mocha::ClassMethod

Instance Method Details

#method_exists?(method) ⇒ Boolean

Returns:

  • (Boolean)

7
8
9
10
11
12
# File 'lib/mocha/module_method.rb', line 7

def method_exists?(method)
  return true if stubbee.public_methods(false).include?(method)
  return true if stubbee.protected_methods(false).include?(method)
  return true if stubbee.private_methods(false).include?(method)
  return false
end