// Overide these functions for custom pass/fail behaviours Smoke.passed = function(mock){ Smoke.passCount++; }; Smoke.failed = function(mock, message){ Smoke.failCount++; throw(message); }; // Some helpers Smoke.reset = function(){ Smoke.mocks = Smoke.mocks || []; for(var i=0; i=this.callCount) Smoke.passed(this);//console.log('Mock passed!') else Smoke.failed(this, 'expected '+this.methodSignature()+' to be called at most '+this.maxCount+" times but it actually got called "+this.callCount+' times'); }, argumentMismatchError: function(args) { Smoke.failed(this, 'expected ' + this._attr + ' with ' + Smoke.printArguments(this.callerArgs) + ' but received it with ' + Smoke.printArguments(args)); }, methodSignature: function(){ return this._attr + Smoke.printArguments(this.callerArgs); }, parseCount: function(c){ switch(c){ case 'once': return 1; case 'twice': return 2; default: return c; } } };