keeping track of passed expectations

This commit is contained in:
Alex Treppass
2014-04-14 14:23:50 +01:00
committed by Sheel Choksi
parent e1e49e8292
commit 5f34be446c
4 changed files with 35 additions and 9 deletions

View File

@@ -175,7 +175,8 @@ describe("Spec", function() {
status: 'pending',
description: 'with a spec',
fullName: 'a suite with a spec',
failedExpectations: []
failedExpectations: [],
passedExpectations: []
});
});
@@ -212,6 +213,23 @@ describe("Spec", function() {
expect(spec.status()).toBe('failed');
});
it("keeps track of passed and failed expectations", function() {
var resultCallback = jasmine.createSpy('resultCallback'),
spec = new j$.Spec({
fn: jasmine.createSpy("spec body"),
expectationResultFactory: function (data) { return data; },
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
resultCallback: resultCallback
});
spec.addExpectationResult(true, 'expectation1');
spec.addExpectationResult(false, 'expectation2');
spec.execute();
expect(resultCallback.calls.first().args[0].passedExpectations).toEqual(['expectation1']);
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['expectation2']);
});
it("can return its full name", function() {
var specNameSpy = jasmine.createSpy('specNameSpy').and.returnValue('expected val');