We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c89fb21 commit 0ea3e17Copy full SHA for 0ea3e17
docs/release-source/release/stubs.md
@@ -520,3 +520,31 @@ myObj.prop = 'baz';
520
521
myObj.example; // 'baz'
522
```
523
+
524
+#### `stub.value(newVal)`
525
526
+Defines a new value for this stub.
527
528
+```javascript
529
+var myObj = {
530
+ example: 'oldValue',
531
+};
532
533
+sinon.stub(myObj, 'example').value('newValue');
534
535
+myObj.example; // 'newValue'
536
+```
537
538
+You can restore values by calling the `restore` method:
539
540
541
542
543
544
545
+var stub = sinon.stub(myObj, 'example').value('newValue');
546
+stub.restore()
547
548
+myObj.example; // 'oldValue'
549
550
0 commit comments