Esempio n. 1
0
					BeforeEach(func() {
						fakeBuildDB.AbortBuildReturns(nil)
					})

					It("succeeds", func() {
						Ω(abortErr).ShouldNot(HaveOccurred())
					})

					It("aborts the build in the db", func() {
						Ω(fakeBuildDB.AbortBuildCallCount()).Should(Equal(1))
						Ω(fakeBuildDB.AbortBuildArgsForCall(0)).Should(Equal(model.ID))
					})

					It("does not abort the real build", func() {
						Ω(fakeBuildDB.GetBuildCallCount()).Should(BeZero())
						Ω(fakeEngineB.LookupBuildCallCount()).Should(BeZero())
					})
				})

				Context("when aborting the build in the db fails", func() {
					disaster := errors.New("oh no!")

					BeforeEach(func() {
						fakeBuildDB.AbortBuildReturns(disaster)
					})

					It("fails", func() {
						Ω(abortErr).Should(Equal(disaster))
					})
				})
			})
Esempio n. 2
0
					BeforeEach(func() {
						fakeBuildDB.AbortBuildReturns(nil)
					})

					It("succeeds", func() {
						Expect(abortErr).NotTo(HaveOccurred())
					})

					It("aborts the build in the db", func() {
						Expect(fakeBuildDB.AbortBuildCallCount()).To(Equal(1))
						Expect(fakeBuildDB.AbortBuildArgsForCall(0)).To(Equal(model.ID))
					})

					It("does not abort the real build", func() {
						Expect(fakeBuildDB.GetBuildCallCount()).To(BeZero())
						Expect(fakeEngineB.LookupBuildCallCount()).To(BeZero())
					})
				})

				Context("when aborting the build in the db fails", func() {
					disaster := errors.New("oh no!")

					BeforeEach(func() {
						fakeBuildDB.AbortBuildReturns(disaster)
					})

					It("fails", func() {
						Expect(abortErr).To(Equal(disaster))
					})
				})
			})