<commit_before>/* jasmine-stealth - 0.0.15
 * Makes Jasmine spies a bit more robust
 * https://github.com/searls/jasmine-stealth
 */
(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  (function() {
    var Captor, fake, root, stubChainer, unfakes, whatToDoWhenTheSpyGetsCalled, _;
    root = this;
    _ = function(obj) {
      return {
        each: function(iterator) {
          var item, _i, _len, _results;
          _results = [];
          for (_i = 0, _len = obj.length; _i < _len; _i++) {
            item = obj[_i];
            _results.push(iterator(item));
          }
          return _results;
        },
        isFunction: function() {
          return Object.prototype.toString.call(obj) === "[object Function]";
        },
        isString: function() {
          return Object.prototype.toString.call(obj) === "[object String]";
        }
      };
    };
    root.spyOnConstructor = function(owner, classToFake, methodsToSpy) {
      var fakeClass, spies;
      if (methodsToSpy == null) {
        methodsToSpy = [];
      }
      if (_(methodsToSpy).isString()) {
        methodsToSpy = [methodsToSpy];
      }
      spies = {
        constructor: jasmine.createSpy("" + classToFake + "'s constructor")
      };
      fakeClass = (function() {
        function _Class() {
          spies.constructor.apply(this, arguments);
        }

        return _Class;

      })();
      _(methodsToSpy).each(function(methodName) {
        spies[methodName] = jasmine.createSpy("" + classToFake + "#" + methodName);
        return fakeClass.prototype[methodName] = function() {
          return spies[methodName].apply(this, arguments);
        };
      });
      fake(owner, classToFake, fakeClass);
      return spies;
    };
    unfakes = [];
    afterEach(function() {
      _(unfakes).each(function(u) {
        return u();
      });
      return unfakes = [];
    });
    fake = function(owner, thingToFake, newThing) {
      var originalThing;
      originalThing = owner[thingToFake];
      owner[thingToFake] = newThing;
      return unfakes.push(function() {
        return owner[thingToFake] = originalThing;
      });
    };
    root.stubFor = root.spyOn;
    jasmine.createStub = jasmine.createSpy;
    jasmine.createStubObj = function(baseName, stubbings) {
      var name, obj, stubbing;
      if (stubbings.constructor === Array) {
        return jasmine.createSpyObj(baseName, stubbings);
      } else {
        obj = {};
        for (name in stubbings) {
          stubbing = stubbings[name];
          obj[name] = jasmine.createSpy(baseName + "." + name);
          if (_(stubbing).isFunction()) {
            obj[name].andCallFake(stubbing);
          } else {
            obj[name].andReturn(stubbing);
          }
        }
        return obj;
      }
    };
    whatToDoWhenTheSpyGetsCalled = function(spy) {
      var matchesStub, priorPlan;
      matchesStub = function(stubbing, args, context) {
        switch (stubbing.type) {
          case "args":
            return jasmine.getEnv().equals_(stubbing.ifThis, jasmine.util.argsToArray(args));
          case "context":
            return jasmine.getEnv().equals_(stubbing.ifThis, context);
        }
      };
      priorPlan = spy.plan;
      return spy.andCallFake(function() {
        var i, stubbing;
        i = 0;
        while (i < spy._stealth_stubbings.length) {
          stubbing = spy._stealth_stubbings[i];
          if (matchesStub(stubbing, arguments, this)) {
            if (stubbing.satisfaction === "callFake") {
              return stubbing.thenThat.apply(stubbing, arguments);
            } else {
              return stubbing.thenThat;
            }
          }
          i++;
        }
        return priorPlan.apply(spy, arguments);
      });
    };
    jasmine.Spy.prototype.whenContext = function(context) {
      var spy;
      spy = this;
      spy._stealth_stubbings || (spy._stealth_stubbings = []);
      whatToDoWhenTheSpyGetsCalled(spy);
      return stubChainer(spy, "context", context);
    };
    jasmine.Spy.prototype.when = function() {
      var ifThis, spy;
      spy = this;
      ifThis = jasmine.util.argsToArray(arguments);
      spy._stealth_stubbings || (spy._stealth_stubbings = []);
      whatToDoWhenTheSpyGetsCalled(spy);
      return stubChainer(spy, "args", ifThis);
    };
    stubChainer = function(spy, type, ifThis) {
      var addStubbing;
      addStubbing = function(satisfaction) {
        return function(thenThat) {
          spy._stealth_stubbings.push({
            type: type,
            ifThis: ifThis,
            satisfaction: satisfaction,
            thenThat: thenThat
          });
          return spy;
        };
      };
      return {
        thenReturn: addStubbing("return"),<commit_msg>Upgrade jasmine-given<commit_after>/* jasmine-stealth - 0.0.16
 * Makes Jasmine spies a bit more robust
 * https://github.com/searls/jasmine-stealth
 */
(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  (function() {
    var Captor, fake, root, stubChainer, unfakes, whatToDoWhenTheSpyGetsCalled, _;
    root = this;
    _ = function(obj) {
      return {
        each: function(iterator) {
          var item, _i, _len, _results;
          _results = [];
          for (_i = 0, _len = obj.length; _i < _len; _i++) {
            item = obj[_i];
            _results.push(iterator(item));
          }
          return _results;
        },
        isFunction: function() {
          return Object.prototype.toString.call(obj) === "[object Function]";
        },
        isString: function() {
          return Object.prototype.toString.call(obj) === "[object String]";
        }
      };
    };
    root.spyOnConstructor = function(owner, classToFake, methodsToSpy) {
      var fakeClass, spies;
      if (methodsToSpy == null) {
        methodsToSpy = [];
      }
      if (_(methodsToSpy).isString()) {
        methodsToSpy = [methodsToSpy];
      }
      spies = {
        constructor: jasmine.createSpy("" + classToFake + "'s constructor")
      };
      fakeClass = (function() {
        function _Class() {
          spies.constructor.apply(this, arguments);
        }

        return _Class;

      })();
      _(methodsToSpy).each(function(methodName) {
        spies[methodName] = jasmine.createSpy("" + classToFake + "#" + methodName);
        return fakeClass.prototype[methodName] = function() {
          return spies[methodName].apply(this, arguments);
        };
      });
      fake(owner, classToFake, fakeClass);
      return spies;
    };
    unfakes = [];
    afterEach(function() {
      _(unfakes).each(function(u) {
        return u();
      });
      return unfakes = [];
    });
    fake = function(owner, thingToFake, newThing) {
      var originalThing;
      originalThing = owner[thingToFake];
      owner[thingToFake] = newThing;
      return unfakes.push(function() {
        return owner[thingToFake] = originalThing;
      });
    };
    root.stubFor = root.spyOn;
    jasmine.createStub = jasmine.createSpy;
    jasmine.createStubObj = function(baseName, stubbings) {
      var name, obj, stubbing;
      if (stubbings.constructor === Array) {
        return jasmine.createSpyObj(baseName, stubbings);
      } else {
        obj = {};
        for (name in stubbings) {
          stubbing = stubbings[name];
          obj[name] = jasmine.createSpy(baseName + "." + name);
          if (_(stubbing).isFunction()) {
            obj[name].andCallFake(stubbing);
          } else {
            obj[name].andReturn(stubbing);
          }
        }
        return obj;
      }
    };
    whatToDoWhenTheSpyGetsCalled = function(spy) {
      var matchesStub, priorPlan;
      matchesStub = function(stubbing, args, context) {
        switch (stubbing.type) {
          case "args":
            return jasmine.getEnv().equals_(stubbing.ifThis, jasmine.util.argsToArray(args));
          case "context":
            return jasmine.getEnv().equals_(stubbing.ifThis, context);
        }
      };
      priorPlan = spy.plan;
      return spy.andCallFake(function() {
        var i, stubbing;
        i = 0;
        while (i < spy._stealth_stubbings.length) {
          stubbing = spy._stealth_stubbings[i];
          if (matchesStub(stubbing, arguments, this)) {
            if (stubbing.satisfaction === "callFake") {
              return stubbing.thenThat.apply(stubbing, arguments);
            } else {
              return stubbing.thenThat;
            }
          }
          i++;
        }
        return priorPlan.apply(spy, arguments);
      });
    };
    jasmine.Spy.prototype.whenContext = function(context) {
      var spy;
      spy = this;
      spy._stealth_stubbings || (spy._stealth_stubbings = []);
      whatToDoWhenTheSpyGetsCalled(spy);
      return stubChainer(spy, "context", context);
    };
    jasmine.Spy.prototype.when = function() {
      var ifThis, spy;
      spy = this;
      ifThis = jasmine.util.argsToArray(arguments);
      spy._stealth_stubbings || (spy._stealth_stubbings = []);
      whatToDoWhenTheSpyGetsCalled(spy);
      return stubChainer(spy, "args", ifThis);
    };
    stubChainer = function(spy, type, ifThis) {
      var addStubbing;
      addStubbing = function(satisfaction) {
        return function(thenThat) {
          spy._stealth_stubbings.unshift({
            type: type,
            ifThis: ifThis,
            satisfaction: satisfaction,
            thenThat: thenThat
          });
          return spy;
        };
      };
      return {
        thenReturn: addStubbing("return"),
{'fraction_non_alphanumeric': 0.1284485315929991, 'fraction_numerical': 0.0011865915158706616, 'mean_word_length': 2.165571205007825, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7236823', 'n_tokens_mistral': 3115, 'n_tokens_neox': 3134, 'n_words': 586}