-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The parent step is now available on all types of step results - Step results "inherit" from a base step result object (extraction refactoring)
- Loading branch information
Showing
16 changed files
with
158 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
var FailedStepResult = function(failureException) { | ||
var self = { | ||
isFailed: function isFailed() { return true; }, | ||
isPending: function isPending() { return false; }, | ||
isSkipped: function isSkipped() { return false; }, | ||
isSuccessful: function isSuccessful() { return false; }, | ||
isUndefined: function isUndefined() { return false; }, | ||
|
||
getFailureException: function getFailureException() { | ||
return failureException; | ||
} | ||
var FailedStepResult = function(payload) { | ||
var Cucumber = require('../../cucumber'); | ||
|
||
var self = Cucumber.Runtime.StepResult(payload); | ||
|
||
self.isFailed = function isFailed() { return true; }; | ||
|
||
self.getFailureException = function getFailureException() { | ||
return payload.failureException; | ||
}; | ||
|
||
return self; | ||
}; | ||
module.exports = FailedStepResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
var PendingStepResult = function() { | ||
var self = { | ||
isFailed: function isFailed() { return false; }, | ||
isPending: function isPending() { return true; }, | ||
isSkipped: function isSkipped() { return false; }, | ||
isSuccessful: function isSuccessful() { return false; }, | ||
isUndefined: function isUndefined() { return false; } | ||
}; | ||
var PendingStepResult = function(payload) { | ||
var Cucumber = require('../../cucumber'); | ||
|
||
var self = Cucumber.Runtime.StepResult(payload); | ||
|
||
self.isPending = function isPending() { return true; }; | ||
|
||
return self; | ||
}; | ||
module.exports = PendingStepResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
var SkippedStepResult = function(payload) { | ||
var self = { | ||
isFailed: function isFailed() { return false; }, | ||
isPending: function isPending() { return false; }, | ||
isSkipped: function isSkipped() { return true; }, | ||
isSuccessful: function isSuccessful() { return false; }, | ||
isUndefined: function isUndefined() { return false; }, | ||
var Cucumber = require('../../cucumber'); | ||
|
||
var self = Cucumber.Runtime.StepResult(payload); | ||
|
||
self.isSkipped = function isSkipped() { return true; }; | ||
|
||
getStep: function getStep() { | ||
return payload['step']; | ||
} | ||
}; | ||
return self; | ||
}; | ||
module.exports = SkippedStepResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var StepResult = function (payload) { | ||
var self = { | ||
isFailed: function isFailed() { return false; }, | ||
isPending: function isPending() { return false; }, | ||
isSkipped: function isSkipped() { return false; }, | ||
isSuccessful: function isSuccessful() { return false; }, | ||
isUndefined: function isUndefined() { return false; }, | ||
|
||
getStep: function getStep() { | ||
return payload.step; | ||
} | ||
}; | ||
|
||
return self; | ||
}; | ||
|
||
module.exports = StepResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
var SuccessfulStepResult = function() { | ||
var self = { | ||
isFailed: function isFailed() { return false; }, | ||
isPending: function isPending() { return false; }, | ||
isSkipped: function isSkipped() { return false; }, | ||
isSuccessful: function isSuccessful() { return true; }, | ||
isUndefined: function isUndefined() { return false; } | ||
}; | ||
var SuccessfulStepResult = function(payload) { | ||
var Cucumber = require('../../cucumber'); | ||
|
||
var self = Cucumber.Runtime.StepResult(payload); | ||
|
||
self.isSuccessful = function isSuccessful() { return true; }; | ||
|
||
return self; | ||
}; | ||
module.exports = SuccessfulStepResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
var UndefinedStepResult = function(payload) { | ||
var self = { | ||
isFailed: function isFailed() { return false; }, | ||
isPending: function isPending() { return false; }, | ||
isSkipped: function isSkipped() { return false; }, | ||
isSuccessful: function isSuccessful() { return false; }, | ||
isUndefined: function isUndefined() { return true; }, | ||
var Cucumber = require('../../cucumber'); | ||
|
||
var self = Cucumber.Runtime.StepResult(payload); | ||
|
||
self.isUndefined = function isUndefined() { return true; }; | ||
|
||
getStep: function getStep() { | ||
return payload['step']; | ||
} | ||
}; | ||
return self; | ||
}; | ||
module.exports = UndefinedStepResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require('../../support/spec_helper'); | ||
|
||
describe("Cucumber.Runtime.StepResult", function() { | ||
var Cucumber = requireLib('cucumber'); | ||
var stepResult, step; | ||
|
||
beforeEach(function() { | ||
step = createSpy("step"); | ||
stepResult = Cucumber.Runtime.StepResult({step: step}); | ||
}); | ||
|
||
it("is not failed", function() { | ||
expect(stepResult.isFailed()).toBeFalsy(); | ||
}); | ||
|
||
it("is not pending", function() { | ||
expect(stepResult.isPending()).toBeFalsy(); | ||
}); | ||
|
||
it("is not skipped", function() { | ||
expect(stepResult.isSkipped()).toBeFalsy(); | ||
}); | ||
|
||
it("is not successful", function () { | ||
expect(stepResult.isSuccessful()).toBeFalsy(); | ||
}); | ||
|
||
it("is not undefined", function() { | ||
expect(stepResult.isUndefined()).toBeFalsy(); | ||
}); | ||
|
||
describe("getStep()", function() { | ||
it("returns the step passed to the constructor", function() { | ||
expect(stepResult.getStep()).toBe(step); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.