Add explicit fail function.

- Adds an expectation failure to the current spec

[finishes #70975468] Fix #563
This commit is contained in:
slackersoft
2014-09-23 08:00:46 -07:00
parent 59aaac026c
commit b1344d5c73
4 changed files with 145 additions and 0 deletions

View File

@@ -335,6 +335,22 @@ getJasmineRequireObj().Env = function(j$) {
this.pending = function() {
throw j$.Spec.pendingSpecExceptionMessage;
};
this.fail = function(error) {
var message = 'Failed';
if (error) {
message += ': ';
message += error.message || error;
}
currentSpec.addExpectationResult(false, {
matcherName: '',
passed: false,
expected: '',
actual: '',
message: message
});
};
}
return Env;

View File

@@ -32,6 +32,10 @@ getJasmineRequireObj().interface = function(jasmine, env) {
return env.pending();
},
fail: function() {
return env.fail.apply(env, arguments);
},
spyOn: function(obj, methodName) {
return env.spyOn(obj, methodName);
},