Explorar el Código

new arg for spyOnMethod

Adam Shaw hace 8 años
padre
commit
ee92ed7f7f
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      tests/lib/jasmine-ext.js

+ 6 - 2
tests/lib/jasmine-ext.js

@@ -212,12 +212,16 @@ beforeEach(function() {
 });
 
 
-function spyOnMethod(Class, methodName) {
+function spyOnMethod(Class, methodName, dontCallThrough) {
 	var origMethod = Class.prototype.hasOwnProperty(methodName) ?
 		Class.prototype[methodName] :
 		null;
 
-	var spy = spyOn(Class.prototype, methodName).and.callThrough();
+	var spy = spyOn(Class.prototype, methodName);
+
+	if (!dontCallThrough) {
+		spy = spy.and.callThrough();
+	}
 
 	spy.restore = function() {
 		if (origMethod) {