Skip to content

Commit

Permalink
Merge pull request #1325 from lucasfcosta/callsFake-docs
Browse files Browse the repository at this point in the history
Add docs for the new callsFake behavior
  • Loading branch information
fatso83 committed Mar 13, 2017
2 parents fee959d + bdd3f82 commit c748bc5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/release-source/release/stubs.md
Expand Up @@ -211,6 +211,22 @@ stub.called // false

*Since `sinon@2.0.0`*

#### `stub.callsFake(fakeFunction);`
Makes the stub call the provided `fakeFunction` when invoked.

```javascript
var myObj = {};
myObj.prop = function propFn() {
return "foo";
};

sinon.stub(myObj, prop).callsFake(function fakeFn() {
return 'bar';
});

myObj.prop(); // 'bar'
```

#### `stub.returns(obj);`
Makes the stub return the provided value.

Expand Down

0 comments on commit c748bc5

Please sign in to comment.