StubClass
- Namespace
- Ancestors
- Subclasses
-
- Mock
-
Object that doesn’t respond to anything except for what’s been explicitly defined on it and throws a mock error whenever it receives a method call.
Object that only responds to a given set of methods and returns itself whenever it receives a method call it doesn’t know anything about.
Class Methods
define(metaObject, methodSymbol, valueObject)#⚙
Defines method on an objects meta object to value. If value is a Proc it’ll be used as a method definition with rules that depend on if whether it’s a lambda or not. Otherwise, the method definition will be set up to return value.
Constructor
initialize(methodsHash<
Symbol,Object>
= {}
)#⚙
Maps each method name key in methods to its value definition. If the value of the key is a Proc it’ll be used as the method definition. Otherwise, the method definition will be set up to return VALUE.
Dynamic Method Handling
This class handles dynamic methods through #method_missing.
method_missing(methodSymbol, *argsObject*)selfprivate#⚙
Ignores any method calls that it doesn’t know anything about.