Skip to content

Commit

Permalink
Add code snippet for createStubInstance (#1423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Goldberg authored and fatso83 committed May 26, 2017
1 parent d8dac84 commit fe049aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/release-source/release/utils.md
Original file line number Diff line number Diff line change
@@ -32,6 +32,16 @@ Restores supplied method

Creates a new object with the given function as the protoype and stubs all implemented functions.

```javascript
class Container {
contains(item) { /* ... */ }
}

var stubContainer = sinon.createStubInstance(Container);
stubContainer.contains.returns(false);
stubContainer.contains.withArgs("item").returns(true);
```

The given constructor function is not invoked. See also the [stub API](../stubs).

#### `sinon.format(object);`

0 comments on commit fe049aa

Please sign in to comment.