Squashed spy refactor and new spy syntax
Jasmine spies now have a 'and' property which allows the user to change the spy's execution strategy-- such as '.and.callReturn(4)' and a 'calls' property which allows inspection of the calls a spy has received. * This is a breaking change * There is a CallTracker that keeps track of all calls and arguments and a SpyStrategy which determines what the spy should do when it is called.
This commit is contained in:
committed by
Colin O'Byrne and JR Boyens
parent
18c30566bd
commit
3847557bbc
@@ -225,11 +225,11 @@ describe("Env integration", function() {
|
||||
"specDone"
|
||||
]);
|
||||
|
||||
reporter.jasmineDone.andCallFake(function() {
|
||||
reporter.jasmineDone.and.callFake(function() {
|
||||
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
||||
totalSpecsDefined: 3
|
||||
});
|
||||
var suiteResult = reporter.suiteStarted.calls[0].args[0];
|
||||
var suiteResult = reporter.suiteStarted.calls.first().args[0];
|
||||
expect(suiteResult.description).toEqual("A Suite");
|
||||
expect(reporter.jasmineDone).toHaveBeenCalled();
|
||||
|
||||
@@ -288,9 +288,9 @@ describe("Env integration", function() {
|
||||
"specDone"
|
||||
]);
|
||||
|
||||
reporter.jasmineDone.andCallFake(function() {
|
||||
var firstSpecResult = reporter.specDone.argsForCall[0][0],
|
||||
secondSpecResult = reporter.specDone.argsForCall[1][0];
|
||||
reporter.jasmineDone.and.callFake(function() {
|
||||
var firstSpecResult = reporter.specDone.calls.first().args[0],
|
||||
secondSpecResult = reporter.specDone.calls.mostRecent().args[0];
|
||||
|
||||
expect(firstSpecResult.status).toEqual("passed");
|
||||
expect(secondSpecResult.status).toEqual("failed");
|
||||
@@ -355,9 +355,9 @@ describe("Env integration", function() {
|
||||
"specDone"
|
||||
]);
|
||||
|
||||
reporter.jasmineDone.andCallFake(function() {
|
||||
var firstSpecResult = reporter.specDone.argsForCall[0][0],
|
||||
secondSpecResult = reporter.specDone.argsForCall[1][0];
|
||||
reporter.jasmineDone.and.callFake(function() {
|
||||
var firstSpecResult = reporter.specDone.calls.first().args[0],
|
||||
secondSpecResult = reporter.specDone.calls.mostRecent().args[0];
|
||||
|
||||
expect(firstSpecResult.status).toEqual("passed");
|
||||
expect(secondSpecResult.status).toEqual("failed");
|
||||
|
||||
Reference in New Issue
Block a user