Пример #1
0
			fakeTaskDB.CancelTaskReturns(task, cellID, nil)
		})

		JustBeforeEach(func() {
			err = controller.CancelTask(logger, taskGuid)
		})

		Context("when the cancel request is normal", func() {
			Context("when canceling the task in the db succeeds", func() {
				BeforeEach(func() {
					cellPresence := models.CellPresence{CellId: "cell-id"}
					fakeServiceClient.CellByIdReturns(&cellPresence, nil)
				})

				It("returns no error", func() {
					Expect(fakeTaskDB.CancelTaskCallCount()).To(Equal(1))
					taskLogger, taskGuid := fakeTaskDB.CancelTaskArgsForCall(0)
					Expect(taskLogger.SessionName()).To(ContainSubstring("cancel-task"))
					Expect(taskGuid).To(Equal("task-guid"))
					Expect(err).NotTo(HaveOccurred())
				})

				Context("and the task has a complete URL", func() {
					BeforeEach(func() {
						task := model_helpers.NewValidTask("hi-bob")
						task.CompletionCallbackUrl = "bogus"
						fakeTaskDB.CancelTaskReturns(task, cellID, nil)
					})

					It("causes the workpool to complete its callback work", func() {
						Eventually(fakeTaskCompletionClient.SubmitCallCount).Should(Equal(1))