}) Context("when getting the job succeeds", func() { BeforeEach(func() { pipelineDB.GetJobReturns(db.SavedJob{ ID: 1, Paused: true, PipelineName: "some-pipeline", Job: db.Job{ Name: "job-1", }, }, nil) }) It("fetches by job", func() { Expect(pipelineDB.GetJobFinishedAndNextBuildCallCount()).To(Equal(1)) jobName := pipelineDB.GetJobFinishedAndNextBuildArgsForCall(0) Expect(jobName).To(Equal("some-job")) }) It("returns 200 OK", func() { Expect(response.StatusCode).To(Equal(http.StatusOK)) }) It("returns the job's name, url, if it's paused, and any running and finished builds", func() { body, err := ioutil.ReadAll(response.Body) Expect(err).NotTo(HaveOccurred()) Expect(body).To(MatchJSON(`{ "name": "some-job",
}) }) Context("when getting the job succeeds", func() { BeforeEach(func() { pipelineDB.GetJobReturns(db.SavedJob{ ID: 1, Paused: true, PipelineName: "some-pipeline", Job: db.Job{ Name: "job-1", }, }, nil) }) It("fetches by job", func() { Ω(pipelineDB.GetJobFinishedAndNextBuildCallCount()).Should(Equal(1)) jobName := pipelineDB.GetJobFinishedAndNextBuildArgsForCall(0) Ω(jobName).Should(Equal("some-job")) }) It("returns 200 OK", func() { Ω(response.StatusCode).Should(Equal(http.StatusOK)) }) It("returns the job's name, url, if it's paused, and any running and finished builds", func() { body, err := ioutil.ReadAll(response.Body) Ω(err).ShouldNot(HaveOccurred()) Ω(body).Should(MatchJSON(`{ "name": "some-job",