Skip to content

Commit

Permalink
Use new sandbox and fake server factory functions in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni committed Aug 6, 2017
1 parent 4c2aa41 commit 6648f1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions docs/release-source/release/fake-xhr-and-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ High-level API to manipulate `FakeXMLHttpRequest` instances.
```javascript
{
setUp: function () {
this.server = sinon.fakeServer.create();
this.server = sinon.createFakeServer();
},

tearDown: function () {
Expand All @@ -225,16 +225,16 @@ High-level API to manipulate `FakeXMLHttpRequest` instances.
```


#### `var server = sinon.fakeServer.create([config]);``
#### `var server = sinon.createFakeServer([config]);``

Creates a new server.

This function also calls `sinon.useFakeXMLHttpRequest()`.

`create` accepts optional properties to configure the fake server. See [options](#options) below for configuration parameters.
`createFakeServer` accepts optional properties to configure the fake server. See [options](#options) below for configuration parameters.


#### `var server = sinon.fakeServerWithClock.create();`
#### `var server = sinon.createFakeServerWithClock();`

Creates a server that also manages fake timers.

Expand Down Expand Up @@ -360,7 +360,7 @@ These options are properties on the server object and can be set directly
server.autoRespond = true
```

You can also pass options with an object literal to `fakeServer.create` and `.configure`.
You can also pass options with an object literal to `createFakeServer` and `.configure`.

#### `Boolean autoRespond`

Expand Down
16 changes: 8 additions & 8 deletions docs/release-source/release/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sandboxes removes the need to keep track of every fake created, which greatly si
var sinon = require('sinon');

var myAPI = { hello: function () {} };
var sandbox = sinon.sandbox.create();
var sandbox = sinon.createSandbox();

describe('myAPI.hello method', function () {

Expand Down Expand Up @@ -39,25 +39,25 @@ describe('myAPI.hello method', function () {

## Sandbox API

#### `var sandbox = sinon.sandbox.create();`
#### `var sandbox = sinon.createSandbox();`

Creates a sandbox object with spies, stubs, and mocks.


#### `var sandbox = sinon.sandbox.create(config);`
#### `var sandbox = sinon.createSandbox(config);`

The `sinon.sandbox.create(config)` method is often an integration feature, and can be used for scenarios including a global object to coordinate all fakes through.
The `sinon.createSandbox(config)` method is often an integration feature, and can be used for scenarios including a global object to coordinate all fakes through.

Sandboxes are partially configured by default such that calling:

```javascript
var sandbox = sinon.sandbox.create({});
var sandbox = sinon.createSandbox({});
```

will merge in extra defaults analogous to:

```javascript
var sandbox = sinon.sandbox.create({
var sandbox = sinon.createSandbox({
// ...
injectInto: null,
properties: ["spy", "stub", "mock"],
Expand All @@ -82,10 +82,10 @@ To get a full sandbox with stubs, spies, etc. **and** fake timers and servers, y

```javascript
// Inject the sinon defaults explicitly.
var sandbox = sinon.sandbox.create(sinon.defaultConfig);
var sandbox = sinon.createSandbox(sinon.defaultConfig);

// (OR) Add the extra properties that differ from the sinon defaults.
var sandbox = sinon.sandbox.create({
var sandbox = sinon.createSandbox({
useFakeTimers: true
useFakeServer: true
});
Expand Down

0 comments on commit 6648f1b

Please sign in to comment.