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

mock factory #13

Open
sungwoncho opened this issue Jun 29, 2015 · 1 comment
Open

mock factory #13

sungwoncho opened this issue Jun 29, 2015 · 1 comment

Comments

@sungwoncho
Copy link

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?

@rbabayoff
Copy link
Member

We don't use mocks, but if you want to create a pr for this, including documentation, I'll be happy to take it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants