Permalink
Browse files

A little more refactoring.

  • Loading branch information...
1 parent d34586d commit 6d819402d94a2908a718908dd26bedb954e10f55 @kristopher kristopher committed Jun 8, 2009
Showing with 8 additions and 6 deletions.
  1. +8 −6 lib/smoke.mock.js
View
@@ -106,9 +106,8 @@ Smoke.Mock.Expectation.prototype = {
return this
},
run: function(args){
- if(typeof(this.callerArgs) == 'undefined' || this.compareArrays(args, this.callerArgs)) {
- this.callCount+=1;
- return true;
+ if((this.callerArgs === undefined) || this.compareArrays(args, this.callerArgs)) {
+ return !!(this.callCount+=1);
};
return false
},
@@ -138,10 +137,13 @@ Smoke.Mock.Expectation.prototype = {
},
parseCount: function(c){
switch(c){
- case 'once' : c=1; break;
- case 'twice' : c=2; break;
+ case 'once':
+ return 1;
+ case 'twice':
+ return 2;
+ default:
+ return c;
}
- return c;
},
compareArrays: function(a,b) {
if (a.length != b.length) return false;

0 comments on commit 6d81940

Please sign in to comment.