Global

Members


INSTANCE

instance string

Source:
Example
mock("obj", mock.INSTANCE);

OBJECT

object string

Source:
Example
mock("obj", mock.OBJECT);

Methods


anything()

anything return special string.
If you use anything in with_param that
should_receive execute method regardless of parameter value.

Source:
Returns:
  • '_js_mock_anything_param'
Type
String
Example
mock("obj").should_receive("something").with_param(1,mock.anything()).and_return("1");

mock(name, type)

create mock in global.

Parameters:
Name Type Description
name string | object | function | class

Mock object of name, object, function or class.

type string

Mock object of type. - mock.INSTANCE, mock.OBJECT(defalut)

Source:
Returns:
Type
Mock
Example
// If `name` is string and `global` not found `name` object that mock create object in global.
mock("obj").should_receive("something");
mock("Sample",mock.INSTANCE).should_receive("something");

// If `name` is object that mock don`t create object.
mock(obj).should_receive("something");
mock(zlass).should_receive("something");