コード例 #1
0
ファイル: on_success_test.go プロジェクト: utako/atc
			var signals chan os.Signal
			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)
コード例 #2
0
ファイル: ensure_test.go プロジェクト: ACPK/atc
			var signals chan os.Signal
			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)
コード例 #3
0
ファイル: on_failure_test.go プロジェクト: ACPK/atc
			var ready chan struct{}

			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)