-
-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1973 from mgred/default-sandbox-example
docs(sandbox): add example for default sandbox
- Loading branch information
Showing
36 changed files
with
540 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,21 @@ describe('myAPI.hello method', function () { | |
|
||
Since `[email protected]`, the `sinon` object is a default sandbox. Unless you have a very advanced setup or need a special configuration, you probably want to just use that one. | ||
|
||
```javascript | ||
const myObject = { | ||
'hello': 'world' | ||
}; | ||
|
||
sinon.stub(myObject, 'hello').value('Sinon'); | ||
|
||
console.log(myObject.hello); | ||
// Sinon | ||
|
||
sinon.restore(); | ||
console.log(myObject.hello); | ||
// world | ||
``` | ||
|
||
#### `var sandbox = sinon.createSandbox();` | ||
|
||
Creates a new sandbox object with spies, stubs, and mocks. | ||
|
Oops, something went wrong.