fakeEngineA.CreateBuildReturns(fakeBuild, nil) }) It("succeeds", func() { Ω(buildErr).ShouldNot(HaveOccurred()) }) It("returns a build", func() { Ω(createdBuild).ShouldNot(BeNil()) }) It("starts the build in the database", func() { Ω(fakeBuildDB.StartBuildCallCount()).Should(Equal(1)) buildID, engine, metadata := fakeBuildDB.StartBuildArgsForCall(0) Ω(buildID).Should(Equal(128)) Ω(engine).Should(Equal("fake-engine-a")) Ω(metadata).Should(Equal("some-metadata")) }) Context("when the build fails to transition to started", func() { BeforeEach(func() { fakeBuildDB.StartBuildReturns(false, nil) }) It("aborts the build", func() { Ω(fakeBuild.AbortCallCount()).Should(Equal(1)) }) }) })