示例#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))
示例#2
0
文件: ensure_test.go 项目: ACPK/atc
			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)
示例#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)