cjohansen / sinon-qunit

A small Sinon.JS adapter for QUnit that provides automatic sandboxing of mocks and stubs
http://cjohansen.no/sinon/qunit
Other
26 stars 12 forks source link

Assertion property: 'notCalled' returns undefined #2

Closed ianneub closed 12 years ago

ianneub commented 12 years ago

It seems that when stubbing out a function that the notCalled property is not being set.

Please see the following:

module("Bug?");
test("testing notCalled", 3, function(){
  this.stub(jQuery, "ajax");

  ok(jQuery.ajax.notCalled); // fails with: failed
  sinon.assert.notCalled(jQuery.ajax); // success with: notCalled
  equal(jQuery.ajax.callCount, 0); // success with: okay, Expected: 0
});

Any thoughts?

Thanks!

cjohansen commented 12 years ago

sinon.assert.notCalled() works, spy.notCalled isn't really a feature at this point. It makes sense to have though, so I made an issue on the Sinon repo to add it: https://github.com/cjohansen/Sinon.JS/issues/74