lib/expect.js
function(fn) {
        // Save off the existing spy method as __functionName
        var newName = '__' + fn;
        self[newName] = self[fn];

        // This is the actual function that will be called when,
        // for example, calledWith() is invoked
        return function() {
          var func = self[newName];
          
          // If this thing is a function, invoke it with all arguments;
          // otherwise, just grab the value of the property.
          var val = typeof func === 'function' ? func.apply(condition, arguments) : func;

          // Negate and return
          return !val;
        };
      }
function(fn) {
        // Save off the existing spy method as __functionName
        var newName = '__' + fn;
        self[newName] = self[fn];

        // This is the actual function that will be called when,
        // for example, calledWith() is invoked
        return function() {
          var func = self[newName];
          
          // If this thing is a function, invoke it with all arguments;
          // otherwise, just grab the value of the property.
          var val = typeof func === 'function' ? func.apply(condition, arguments) : func;

          // Negate and return
          return !val;
        };
      }
function ( fn ) { // Save off the existing spy method as __functionName var newName = '__' + fn ; self [ newName ] = self [ fn ] ; // This is the actual function that will be called when, // for example, calledWith() is invoked return function ( ) { var func = self [ newName ] ; // If this thing is a function, invoke it with all arguments; // otherwise, just grab the value of the property. var val = typeof func === 'function' ? func . apply ( condition , arguments ) : func ; // Negate and return return ! val ; } ; }
Wrapper to create a function for negating spy methods
Wrapper to create a function for negating spy methods