Skip to content
This repository was archived by the owner on Dec 27, 2018. It is now read-only.
This repository was archived by the owner on Dec 27, 2018. It is now read-only.

mock factory #13

@sungwoncho

Description

@sungwoncho

Currently, to create mocks:

var mock = sinon.mock(myObject);
mock.expects('myMethod').once();

...

mock.verify();

What about adding a mock factory such that:

mocks.create('myMethod', myObject, 'myMethod');

mocks.myMethod;
mocks.get(myMethod); // get the mock object

mocks.restore(myMethod);
mocks.myMethod.restore; // restore

mocks.myMethod.once();
mocks.myMethod.verify(); // verify
//or
expect(mocks.myMethod).to.have.been.called();

Suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions