Make the check for pending spec exception work for values that don't have toString
This commit is contained in:
@@ -366,7 +366,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
Spec.pendingSpecExceptionMessage = "=> marked Pending";
|
||||
|
||||
Spec.isPendingSpecException = function(e) {
|
||||
return e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1;
|
||||
return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
|
||||
};
|
||||
|
||||
return Spec;
|
||||
|
||||
@@ -20,6 +20,10 @@ describe("Spec", function() {
|
||||
expect(j$.Spec.isPendingSpecException(e)).toBe(false);
|
||||
});
|
||||
|
||||
it("#isPendingSpecException returns false for thrown values that don't have toString", function() {
|
||||
expect(j$.Spec.isPendingSpecException(void 0)).toBe(false);
|
||||
});
|
||||
|
||||
it("delegates execution to a QueueRunner", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
spec = new j$.Spec({
|
||||
|
||||
@@ -141,7 +141,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
Spec.pendingSpecExceptionMessage = "=> marked Pending";
|
||||
|
||||
Spec.isPendingSpecException = function(e) {
|
||||
return e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1;
|
||||
return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
|
||||
};
|
||||
|
||||
return Spec;
|
||||
|
||||
Reference in New Issue
Block a user