Skip to content

Instantly share code, notes, and snippets.

@kinsteronline
Created March 27, 2013 18:07
Show Gist options
  • Save kinsteronline/5256646 to your computer and use it in GitHub Desktop.
Save kinsteronline/5256646 to your computer and use it in GitHub Desktop.
Does this work? Will this give me the ruby mocha like expectation? missle.expects(:launch).never
function callWatcher(fn) {
var called = false;
return function() {
if(!called) {
called = true;
}
return !called;
};
}
var successfulCallback = function() {
console.log("I am a raving success!!!!");
};
successfulCallback = callWatcher(successfulCallback);
// Has this callback been called?
expect(successfulCallback()).to.be.false;
expect(successfulCallback()).to.be.true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment