} fakeDB.GetConfigReturns(config, db.ConfigVersion(1), nil) }) It("returns not found if the job cannot be found in the config", func() { _, err := FetchTemplateData(fakeDB, "not-a-job-name") Ω(err).Should(HaveOccurred()) Ω(err).Should(MatchError(ErrJobConfigNotFound)) }) Context("when the job can be found in the config", func() { Context("when the job builds lookup returns an error", func() { It("returns an error if the jobs's builds could not be retreived", func() { fakeDB.GetAllJobBuildsReturns([]db.Build{}, errors.New("disaster")) _, err := FetchTemplateData(fakeDB, "job-name") Ω(err).Should(HaveOccurred()) }) }) Context("when the job builds lookup returns a build", func() { var buildsWithResources []BuildWithInputsOutputs var builds []db.Build BeforeEach(func() { endTime := time.Now() builds = []db.Build{ { ID: 1,