inputStep.RunReturns(nil) }) Context("when executing the task errors", func() { disaster := errors.New("oh no!") BeforeEach(func() { taskStep.RunReturns(disaster) }) It("does not run any outputs", func() { Ω(outputStep.RunCallCount()).Should(BeZero()) }) It("finishes with error", func() { Ω(fakeDelegate.FinishCallCount()).Should(Equal(1)) _, cbErr, _, _ := fakeDelegate.FinishArgsForCall(0) Ω(cbErr).Should(MatchError(ContainSubstring(disaster.Error()))) }) }) Context("when executing the task succeeds", func() { BeforeEach(func() { taskStep.RunReturns(nil) taskStep.ResultStub = successResult(true) }) Context("when the output should perform on success", func() { BeforeEach(func() { outputPlan.Conditions = atc.Conditions{atc.ConditionSuccess} })