Пример #1
0
		})

		Context("when authenticated", func() {
			BeforeEach(func() {
				authValidator.IsAuthenticatedReturns(true)
			})

			It("injects the proper pipelineDB", func() {
				Ω(pipelineDBFactory.BuildWithNameCallCount()).Should(Equal(1))
				pipelineName := pipelineDBFactory.BuildWithNameArgsForCall(0)
				Ω(pipelineName).Should(Equal("a-pipeline"))
			})

			Context("when enabling the resource succeeds", func() {
				BeforeEach(func() {
					pipelineDB.DisableVersionedResourceReturns(nil)
				})

				It("disabled the right versioned resource", func() {
					Ω(pipelineDB.DisableVersionedResourceArgsForCall(0)).Should(Equal(42))
				})

				It("returns 200", func() {
					Ω(response.StatusCode).Should(Equal(http.StatusOK))
				})
			})

			Context("when enabling the resource fails", func() {
				BeforeEach(func() {
					pipelineDB.DisableVersionedResourceReturns(errors.New("welp"))
				})