true, nil, ) fakePipelineDB.GetNextPendingBuildReturns( db.Build{ ID: 128, Name: "42", }, nil, ) }) Context("and it can be scheduled", func() { BeforeEach(func() { fakePipelineDB.ScheduleBuildReturns(true, nil) }) Context("and creating the engine build succeeds", func() { var createdBuild *enginefakes.FakeBuild BeforeEach(func() { createdBuild = new(enginefakes.FakeBuild) fakeEngine.CreateBuildReturns(createdBuild, nil) }) It("triggers a build of the job with the found inputs", func() { err := scheduler.BuildLatestInputs(logger, job, resources) Ω(err).ShouldNot(HaveOccurred()) Ω(fakePipelineDB.ScheduleBuildCallCount()).Should(Equal(1))