Sha256: 040c178a5ebd6f318dce9be93fdea45d00b6e8b1ec1b77fa9139b3fc730f43d3

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

(function(global) {
  
  var spyMatchers = "called calledOnce calledTwice calledThrice calledBefore calledAfter calledOn alwaysCalledOn calledWith alwaysCalledWith calledWithExactly alwaysCalledWithExactly".split(" "),
    i = spyMatchers.length,
    spyMatcherHash = {},
    unusualMatchers = {
      "returned": "toHaveReturned",
      "alwaysReturned": "toHaveAlwaysReturned"
    },
    
  getMatcherFunction = function(sinonName) {
    return function() {
      var sinonProperty = this.actual[sinonName];
      return (typeof sinonProperty === 'function') ? sinonProperty.apply(this.actual, arguments) : sinonProperty;
    };
  };
    
  while(i--) {
    var sinonName = spyMatchers[i],
      matcherName = "toHaveBeen" + sinonName.charAt(0).toUpperCase() + sinonName.slice(1);
      
    spyMatcherHash[matcherName] = getMatcherFunction(sinonName);
  };
  
  for (var j in unusualMatchers) {
    spyMatcherHash[unusualMatchers[j]] = getMatcherFunction(j);
  }
  
  global.sinonJasmine = {
    getMatchers: function() {
      return spyMatcherHash;
    }
  };
  
})(window);

beforeEach(function() {
  
  this.addMatchers(sinonJasmine.getMatchers());
  
});

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
backbone-jasmine-0.0.1 lib/generators/backbone_jasmine/install/templates/jasmine-sinon.js
test_track-0.0.4 vendor/assets/javascripts/sinon/jasmine-sinon.js
test_track-0.0.3 vendor/assets/javascripts/sinon/jasmine-sinon.js
test_track-0.0.1 vendor/assets/javascripts/sinon/jasmine-sinon.js