Пример #1
0
				})
			})

			Context("when the resource is found in the config", func() {
				BeforeEach(func() {
					resourceName = "resource-1"
				})

				It("looks it up in the database", func() {
					Expect(fakePipelineDB.GetResourceCallCount()).To(Equal(1))
					Expect(fakePipelineDB.GetResourceArgsForCall(0)).To(Equal("resource-1"))
				})

				Context("when the call to the db returns an error", func() {
					BeforeEach(func() {
						fakePipelineDB.GetResourceReturns(db.SavedResource{}, errors.New("Oh no!"))
					})

					It("returns a 500 error", func() {
						Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
					})
				})

				Context("when the call to get a resource succeeds", func() {
					BeforeEach(func() {
						fakePipelineDB.GetResourceReturns(db.SavedResource{
							ID:           1,
							CheckError:   errors.New("sup"),
							Paused:       true,
							PipelineName: "a-pipeline",
							Resource: db.Resource{