Stubs all the object’s methods. Note that it’s usually better practice to stub individual methods, particularly on objects that you don’t understand or control all the methods for (e.g. library dependencies). Stubbing individual methods tests intent more precisely and is less susceptible to unexpected behavior as the object’s code evolves. If you want to create a stub object of MyConstructor, but don’t want the constructor to be invoked, use this utility function.
Replaces obj.method with a stub function. An exception is thrown if the property is not already a function. The original function can be restored by calling object.method.restore(); (or stub.restore();).
Creates an anonymous stub function