Ejemplo n.º 1
0
							dbJob = db.SavedJob{
								Paused: false,
								Job: db.Job{
									Name: "some-job",
								},
							}

							fakeDB.GetJobReturns(dbJob, nil)
							fakeDB.GetPipelineNameReturns("some-pipeline")
						})

						Context("when the current build lookup returns an error", func() {

							It("has the correct template data and sets the current build status to pending", func() {
								fakeDB.GetCurrentBuildReturns(db.Build{}, errors.New("No current build"))

								templateData, err := FetchTemplateData(fakeDB, "job-name")
								Ω(err).ShouldNot(HaveOccurred())

								Ω(templateData.GroupStates).Should(ConsistOf(groupStates))
								Ω(templateData.Job).Should(Equal(job))
								Ω(templateData.DBJob).Should(Equal(dbJob))
								Ω(templateData.Builds).Should(Equal(buildsWithResources))
								Ω(templateData.CurrentBuild).Should(Equal(db.Build{
									Status: db.StatusPending,
								}))
								Ω(templateData.PipelineName).Should(Equal("some-pipeline"))
							})

						})