Context("when authenticated", func() { BeforeEach(func() { authValidator.IsAuthenticatedReturns(true) }) It("injects the PipelineDB", func() { Expect(pipelineDBFactory.BuildWithTeamNameAndNameCallCount()).To(Equal(1)) teamName, pipelineName := pipelineDBFactory.BuildWithTeamNameAndNameArgsForCall(0) Expect(pipelineName).To(Equal("some-pipeline")) Expect(teamName).To(Equal(atc.DefaultTeamName)) }) Context("when pausing the resource succeeds", func() { BeforeEach(func() { pipelineDB.PauseJobReturns(nil) }) It("paused the right job", func() { Expect(pipelineDB.PauseJobArgsForCall(0)).To(Equal("job-name")) }) It("returns 200", func() { Expect(response.StatusCode).To(Equal(http.StatusOK)) }) }) Context("when pausing the job fails", func() { BeforeEach(func() { pipelineDB.PauseJobReturns(errors.New("welp")) })