Describe("Release", func() { var ( signals chan os.Signal ready chan struct{} ) Context("when both step and hook are run", func() { BeforeEach(func() { signals = make(chan os.Signal, 1) ready = make(chan struct{}, 1) step.ResultStub = successResult(true) }) It("calls release on both step and hook", func() { onSuccessStep.Run(signals, ready) onSuccessStep.Release() Ω(step.ReleaseCallCount()).Should(Equal(1)) Ω(hook.ReleaseCallCount()).Should(Equal(1)) }) }) Context("when only step runs", func() { BeforeEach(func() { signals = make(chan os.Signal, 1) ready = make(chan struct{}, 1) step.ResultStub = successResult(false) }) It("calls release on step", func() { onSuccessStep.Run(signals, ready) onSuccessStep.Release() Ω(step.ReleaseCallCount()).Should(Equal(1))
ensureStep.Run(signals, ready) ensureStep.Result(&succeeded) Expect(bool(succeeded)).To(BeFalse()) }) }) }) Describe("Release", func() { var ( signals chan os.Signal ready chan struct{} ) Context("when both step and hook are run", func() { BeforeEach(func() { signals = make(chan os.Signal, 1) ready = make(chan struct{}, 1) step.ResultStub = successResult(true) }) It("calls release on both step and hook", func() { ensureStep.Run(signals, ready) ensureStep.Release() Expect(step.ReleaseCallCount()).To(Equal(1)) Expect(hook.ReleaseCallCount()).To(Equal(1)) }) }) }) }) })
Describe("Release", func() { var ( signals chan os.Signal ready chan struct{} ) Context("when both step and hook are run", func() { BeforeEach(func() { signals = make(chan os.Signal, 1) ready = make(chan struct{}, 1) step.ResultStub = successResult(false) }) It("calls release on both step and hook", func() { onFailureStep.Run(signals, ready) onFailureStep.Release() Expect(step.ReleaseCallCount()).To(Equal(1)) Expect(hook.ReleaseCallCount()).To(Equal(1)) }) }) Context("when only step runs", func() { BeforeEach(func() { signals = make(chan os.Signal, 1) ready = make(chan struct{}, 1) step.ResultStub = successResult(true) }) It("calls release only on step", func() { onFailureStep.Run(signals, ready) onFailureStep.Release()