Example #1
0
				authValidator.IsAuthenticatedReturns(true)
			})

			It("returns 204 No Content", func() {
				Expect(response.StatusCode).To(Equal(http.StatusNoContent))
			})

			It("injects the proper pipelineDB", func() {
				Expect(pipelineDBFactory.BuildWithTeamNameAndNameCallCount()).To(Equal(1))
				teamName, pipelineName := pipelineDBFactory.BuildWithTeamNameAndNameArgsForCall(0)
				Expect(pipelineName).To(Equal("a-pipeline-name"))
				Expect(teamName).To(Equal(atc.DefaultTeamName))
			})

			It("deletes the named pipeline from the database", func() {
				Expect(pipelineDB.DestroyCallCount()).To(Equal(1))
			})

			Context("when an error occurs destroying the pipeline", func() {
				BeforeEach(func() {
					err := errors.New("disaster!")
					pipelineDB.DestroyReturns(err)
				})

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

		Context("when the user is not logged in", func() {
Example #2
0
			BeforeEach(func() {
				authValidator.IsAuthenticatedReturns(true)
			})

			It("returns 204 No Content", func() {
				Ω(response.StatusCode).Should(Equal(http.StatusNoContent))
			})

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

			It("deletes the named pipeline from the database", func() {
				Ω(pipelineDB.DestroyCallCount()).Should(Equal(1))
			})

			Context("when an error occurs destroying the pipeline", func() {
				BeforeEach(func() {
					err := errors.New("disaster!")
					pipelineDB.DestroyReturns(err)
				})

				It("returns a 500 Internal Server Error", func() {
					Ω(response.StatusCode).Should(Equal(http.StatusInternalServerError))
				})
			})
		})

		Context("when the user is not logged in", func() {