public/qunit/qunit.mock.js in entityjs-0.4.3 vs public/qunit/qunit.mock.js in entityjs-0.4.4
- old
+ new
@@ -48,11 +48,13 @@
expectation.args = args;
return expectation.callCount += 1;
};
- return mocking.expectations.push(expectation);
+ mocking.expectations.push(expectation);
+
+ return object[method];
};
stub = function(object, method, fn) {
var stb;
if(fn == null){
@@ -68,9 +70,14 @@
object: object,
method: method,
original: object[method]
};
object[method] = fn;
+
+ if(!mocking || !mocking.stubs){
+ throw "Can only stub inside tests!";
+ }
+
return mocking.stubs.push(stb);
};
mock = function(test) {
var mk;
mk = {
\ No newline at end of file