busterjs/buster — Issue #62: Sinon expectations not treated as assertions: "No assertions!"
Author: rvagg
Created: 2012-01-26 09:47:26+00:00
State: open

Have to insert at least one assertion to get a mock-only test to pass (I guess it'd be the same with spys and stubs?).

```js
var buster = require('buster')
var api = {
fn: function() {}
}

buster.testCase('mocks', {
'expectation, no assertions': function () {
this.mock(api).expects('fn').once().withArgs(1, 2).returns(3)
api.fn(1, 2)
// Failure, "No assertions!"
},
'expectation, explicit verify, no assertions': function () {
var mock = this.mock(api).expects('fn').once().withArgs(1, 2).returns(3)
api.fn(1, 2)
mock.verify()
// Failure, "No assertions!"
},
'expectation, no assertions, bad call': function () {
this.mock(api).expects('fn').once().withArgs(1, 2).returns(3)
api.fn('yeehaw!')
// Gives appropriate 'Error' without the Failure (good)
},
'expectation and assertion': function () {
this.mock(api).expects('fn').once().withArgs(1, 2).returns(3)
assert(api.fn(1, 2))
// Pass
}
})
```