Permalink
Browse files

DRY

  • Loading branch information...
1 parent 2909f48 commit a6b2d76bbf37641536f45a03e84763921bc32758 @jbpros jbpros committed Nov 27, 2013
@@ -9,10 +9,6 @@ var FailedStepResult = function(payload) {
return payload.failureException;
};
- self.getDuration = function getDuration() {
- return payload.duration;
- };
-
return self;
};
module.exports = FailedStepResult;
@@ -8,6 +8,10 @@ var StepResult = function (payload) {
getStep: function getStep() {
return payload.step;
+ },
+
+ getDuration: function getDuration() {
+ return payload.duration;
}
};
@@ -5,10 +5,6 @@ var SuccessfulStepResult = function(payload) {
self.isSuccessful = function isSuccessful() { return true; };
- self.getDuration = function getDuration() {
- return payload.duration;
- };
-
return self;
};
module.exports = SuccessfulStepResult;
@@ -9,7 +9,7 @@ describe("Cucumber.Runtime.FailedStepResult", function() {
spyOn(Cucumber.Runtime, 'StepResult').andReturn(stepResult);
step = createSpy("step");
failureException = createSpy("failure exception");
- payload = {step: step, failureException: failureException, duration: 1};
+ payload = { step: step, failureException: failureException };
failedStepResult = Cucumber.Runtime.FailedStepResult(payload);
});
@@ -28,10 +28,4 @@ describe("Cucumber.Runtime.FailedStepResult", function() {
expect(failedStepResult.getFailureException()).toBe(failureException);
});
});
-
- describe("getDuration()", function() {
- it("returns the duration passed to the constructor", function() {
- expect(failedStepResult.getDuration()).toBe(1);
- });
- });
});
@@ -6,7 +6,7 @@ describe("Cucumber.Runtime.StepResult", function() {
beforeEach(function() {
step = createSpy("step");
- stepResult = Cucumber.Runtime.StepResult({step: step});
+ stepResult = Cucumber.Runtime.StepResult({ step: step, duration: 123 });
});
it("is not failed", function() {
@@ -34,4 +34,10 @@ describe("Cucumber.Runtime.StepResult", function() {
expect(stepResult.getStep()).toBe(step);
});
});
+
+ describe("getDuration()", function() {
+ it("returns the duration passed to the constructor", function() {
+ expect(stepResult.getDuration()).toBe(123);
+ });
+ });
});
@@ -8,7 +8,7 @@ describe("Cucumber.Runtime.SuccessfulStepResult", function() {
stepResult = createSpy("base step result");
spyOn(Cucumber.Runtime, 'StepResult').andReturn(stepResult);
step = createSpy("step");
- payload = {step: step, duration: 1};
+ payload = { step: step };
successfulStepResult = Cucumber.Runtime.SuccessfulStepResult(payload);
});
@@ -21,10 +21,4 @@ describe("Cucumber.Runtime.SuccessfulStepResult", function() {
expect(Cucumber.Runtime.StepResult).toHaveBeenCalledWith(payload);
});
});
-
- describe("getDuration()", function() {
- it("returns the duration passed to the constructor", function() {
- expect(successfulStepResult.getDuration()).toBe(1);
- });
- });
});

0 comments on commit a6b2d76

Please sign in to comment.