Function Namespace MonkeyPatcher
- Defined in: MonkeyPatcher.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
|
patch(object, attr, value)
Patch the attr property on object to have the given value.
|
|
| <static> |
MonkeyPatcher.setUp(cb)
|
| <static> |
MonkeyPatcher.tearDown(cb)
|
|
tearDown()
Tear down this MonkeyPatcher, removing all patches and restoring
the patched objects to their original states.
|
|
|
wrap(object, attr, method)
Like patch(), but intended for wrapping methods when the wrapper needs
access to the original method implementation.
|
Function Namespace Detail
MonkeyPatcher()
Method Detail
-
patch(object, attr, value)Patch the attr property on object to have the given value. The patch will be removed and the original value restored when tearDown() is called.
- Parameters:
- object
- attr
- value
-
<static> MonkeyPatcher.setUp(cb)
- Parameters:
- {function} cb
-
<static> MonkeyPatcher.tearDown(cb)
- Parameters:
- {function} cb
-
tearDown()Tear down this MonkeyPatcher, removing all patches and restoring the patched objects to their original states.
-
wrap(object, attr, method)Like patch(), but intended for wrapping methods when the wrapper needs access to the original method implementation. Within the body of the given method it is possible to call this.wrappedMethod() to invoke the original.
- Parameters:
- object
- attr
- method