Ejemplo n.º 1
0
		)

		BeforeEach(func() {
			taskGuid = "task-guid"
			failureReason = "just cuz ;)"
			task := model_helpers.NewValidTask("hi-bob")
			fakeTaskDB.FailTaskReturns(task, nil)
		})

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

		Context("when failing the task succeeds", func() {
			It("returns no error", func() {
				_, actualTaskGuid, actualFailureReason := fakeTaskDB.FailTaskArgsForCall(0)
				Expect(actualTaskGuid).To(Equal(taskGuid))
				Expect(actualFailureReason).To(Equal(failureReason))
				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.FailTaskReturns(task, nil)
				})

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