示例#1
0
				})

				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",
示例#2
0
文件: jobs_test.go 项目: utako/atc
					})
				})
				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",