Ejemplo n.º 1
0
			var ready chan struct{}
			BeforeEach(func() {
				signals = make(chan os.Signal, 1)
				ready = make(chan struct{}, 1)
			})

			Context("when both step and hook succeed", func() {
				BeforeEach(func() {
					step.ResultStub = successResult(true)
					hook.ResultStub = successResult(true)
				})

				It("assigns the provided interface to true", func() {
					var succeeded exec.Success
					onSuccessStep.Run(signals, ready)
					onSuccessStep.Result(&succeeded)

					Ω(bool(succeeded)).To(BeTrue())
				})
			})

			Context("when step fails", func() {
				BeforeEach(func() {
					step.ResultStub = successResult(false)
				})

				It("does not run hook and assigns the provided interface to false", func() {
					var succeeded exec.Success
					onSuccessStep.Run(signals, ready)
					onSuccessStep.Result(&succeeded)
					Ω(hook.RunCallCount()).To(Equal(0))
Ejemplo n.º 2
0
			var ready chan struct{}
			BeforeEach(func() {
				signals = make(chan os.Signal, 1)
				ready = make(chan struct{}, 1)
			})

			Context("when both step and hook succeed", func() {
				BeforeEach(func() {
					step.ResultStub = successResult(true)
					hook.ResultStub = successResult(true)
				})

				It("assigns the provided interface to true", func() {
					var succeeded exec.Success
					ensureStep.Run(signals, ready)
					ensureStep.Result(&succeeded)

					Expect(bool(succeeded)).To(BeTrue())
				})
			})

			Context("when step succeeds and hook fails", func() {
				BeforeEach(func() {
					step.ResultStub = successResult(true)
					hook.ResultStub = successResult(false)
				})

				It("assigns the provided interface to false", func() {
					var succeeded exec.Success
					ensureStep.Run(signals, ready)
					ensureStep.Result(&succeeded)
Ejemplo n.º 3
0
			BeforeEach(func() {
				signals = make(chan os.Signal, 1)
				ready = make(chan struct{}, 1)
			})

			Context("when step fails and hook fails", func() {
				BeforeEach(func() {
					step.ResultStub = successResult(false)
					hook.ResultStub = successResult(false)
				})

				It("assigns the provided interface to false", func() {
					var succeeded exec.Success
					onFailureStep.Run(signals, ready)
					onFailureStep.Result(&succeeded)

					Expect(bool(succeeded)).To(BeFalse())
				})
			})

			Context("when step fails and hook succeeds", func() {
				BeforeEach(func() {
					step.ResultStub = successResult(false)
					hook.ResultStub = successResult(true)
				})

				It("assigns the provided interface to false", func() {
					var succeeded exec.Success
					onFailureStep.Run(signals, ready)
					onFailureStep.Result(&succeeded)