labs.mock.MockSpyManager_ Extends goog.labs.mock.MockObjectManager_
Sets up the spying behavior for the given object.

Inheritance

Constructor

goog.labs.mock.MockSpyManager_(obj)

Parameters

obj : !Object
The object to be spied on.

Instance Methods

Public Protected Private
findBinding() !Function
Return a stub, if defined, for the method and arguments passed in. If we lack a stub, instead look for a call record that matches the method and arguments.
Returns: !Function  The stub or the invocation logger, if defined.
code »
addBinding(methodNameargsfunc)
Adds a binding for the method name and arguments to be stubbed.
Arguments:
methodName : ?string
The name of the stubbed method.
args : !Array
The arguments passed to the method.
func : !Function
The stub function.
code »
executeStub(methodNamevar_args) *
Looks up the list of stubs defined on the mock object and executes the function associated with that stub.
Arguments:
methodName : string
The name of the method to execute.
var_args : ...
The arguments passed to the method.
Returns: *  Value returned by the stub function.
code »
findBinding(methodNameargs) Function
Returns a stub, if defined, for the method name and arguments passed in.
Arguments:
methodName : string
The name of the stubbed method.
args : !Array
The arguments passed to the method.
Returns: Function  The stub function or undefined.
code »
getExecutor(methodNameargs) Function
Returns a stub, if defined, for the method name and arguments passed in as parameters.
Arguments:
methodName : string
The name of the stubbed method.
args : !Array
The arguments passed to the method.
Returns: Function  The stub function or undefined.
code »
getMockedItem() !Object | !Function
Returns the mock object. This should have a stubbed method for each method on the object being mocked.
Returns: !Object | !Function  The mock object.
code »
handleMockCall_(methodNamevar_args) !goog.labs.mock.StubBinder_
Handles the first step in creating a stub, returning a stub-binder that is later used to bind a stub for a method.
Arguments:
methodName : string
The name of the method being bound.
var_args : ...
The arguments to the method.
Returns: !goog.labs.mock.StubBinder_  The stub binder.
code »
recordCall_(methodNameargs)
Records a call to 'methodName' with arguments 'args'.
Arguments:
methodName : string
The name of the called method.
args : !Array
The array of arguments.
code »
verifyInvocation(methodNamevar_args)
Verify invocation of a method with specific arguments.
Arguments:
methodName : string
The name of the method.
var_args : ...
The arguments passed.
code »

Instance Properties

constructor :
No description.
Code »
constructor :
No description.
Code »
objectCallVerifier_ :
The call verifier is used to verify the calls. It maps property names to the method that does call verification.
Code »
objectStubBinder_ :
Proxies the calls to establish the first step of the stub bindings (object and method name)
Code »
$stubBinder :
Holds a reference to the binder used to define stubs.
Code »
callRecords_ :
Record method calls with no stub definitions.
Code »
methodBindings :
Holds the stub bindings established so far.
Code »
mockedItem :
Proxies the methods for the mocked object or class to execute the stubs.
Code »
mockee :
A reference to the object or function being mocked.
Code »

Static Properties

goog.labs.mock.MockSpyManager_.superClass_ :
No description.
Code »

Package labs.mock

Package Reference