unexpected-sinon
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -71,3 +71,3 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk> | ||
expect.addAssertion('was [always] called with [exactly]', function (expect, subject) { | ||
var args = [subject].concat(Array.prototype.slice.call(arguments, 2)); | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
if (this.flags.always && this.flags.exactly) { | ||
@@ -85,3 +85,3 @@ sinon.assert.alwaysCalledWithExactly.apply(null, args); | ||
expect.addAssertion('was never called with', function (expect, subject) { | ||
var args = [subject].concat(Array.prototype.slice.call(arguments, 2)); | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
sinon.assert.neverCalledWith.apply(null, args); | ||
@@ -99,3 +99,3 @@ }); | ||
expect.addAssertion('was [always] called with match', function (expect, subject) { | ||
var args = [subject].concat(Array.prototype.slice.call(arguments)); | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
if (this.flags.always) { | ||
@@ -102,0 +102,0 @@ sinon.assert.alwaysCalledWithMatch.apply(null, args); |
{ | ||
"name": "unexpected-sinon", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha" | ||
"test": "./node_modules/.bin/mocha --require ./test/common" | ||
}, | ||
@@ -23,0 +23,0 @@ "main": "./lib/unexpected-sinon.js", |
@@ -41,15 +41,3 @@ # Unexpected-sinon | ||
```html | ||
<!-- SinonJS --> | ||
<script src="sinon.js"></script> | ||
<script src="sinon/spy.js"></script> | ||
<script src="sinon/stub.js"></script> | ||
<script src="sinon/mock.js"></script> | ||
<script src="sinon/collection.js"></script> | ||
<script src="sinon/assert.js"></script> | ||
<script src="sinon/sandbox.js"></script> | ||
<script src="sinon/test.js"></script> | ||
<script src="sinon/test_case.js"></script> | ||
<script src="sinon/assert.js"></script> | ||
<script src="sinon/match.js"></script> | ||
<!-- Unexpected --> | ||
<script src="unexpected.js"></script> | ||
@@ -214,1 +202,22 @@ <script src="unexpected-sinon.js"></script> | ||
``` | ||
## Expectations on arguments of individual calls | ||
```js | ||
spy({ foo: 'bar' }, 'baz'); | ||
spy('qux'); | ||
spy('quux'); | ||
expect(spy.args, 'to equal', [ | ||
[{ foo: 'bar' }, 'baz'], | ||
['qux'], | ||
['quux'] | ||
]); | ||
expect(spy.args[1], 'to equal', ['qux']); | ||
expect(spy.args, 'to have properties', { | ||
0: [{ foo: 'bar' }, 'baz'], | ||
2: ['quux'] | ||
}); | ||
``` |
@@ -204,3 +204,3 @@ /*global describe, it, beforeEach, sinon, expect, unexpectedSinon*/ | ||
expect(spy, 'was called with', { foo: 'bar' }, 'baz', sinon.match.truthy); | ||
}, 'to throw exception', /expected spy to be called with arguments/); | ||
}, 'to throw exception', /expected spy to be called with arguments { foo: "bar" }, baz, truthy/); | ||
}); | ||
@@ -213,3 +213,3 @@ }); | ||
spy({ foo: 'bar' }, 'baz', true, false); | ||
expect(spy, 'was called with', { foo: 'bar' }, 'baz', sinon.match.truthy); | ||
expect(spy, 'was called with match', { foo: 'bar' }, 'baz', sinon.match.truthy); | ||
}); | ||
@@ -220,4 +220,4 @@ | ||
spy({ foo: 'baa' }, 'baz', true, false); | ||
expect(spy, 'was called with', { foo: 'bar' }, 'baz', sinon.match.truthy); | ||
}, 'to throw exception', /expected spy to be called with arguments/); | ||
expect(spy, 'was called with match', { foo: 'bar' }, 'baz', sinon.match.truthy); | ||
}, 'to throw exception', /expected spy to be called with match { foo: "bar" }, baz, truthy/); | ||
}); | ||
@@ -224,0 +224,0 @@ }); |
Sorry, the diff of this file is not supported yet
222
141733