Example #1
0
			cellId = "c-id"
			failed = true
			failureReason = "some-error"
			result = "yeah"

			task := model_helpers.NewValidTask("hi-bob")
			fakeTaskDB.CompleteTaskReturns(task, nil)
		})

		JustBeforeEach(func() {
			err = controller.CompleteTask(logger, taskGuid, cellId, failed, failureReason, result)
		})

		Context("when completing the task succeeds", func() {
			It("returns no error", func() {
				Expect(fakeTaskDB.CompleteTaskCallCount()).To(Equal(1))
				_, actualTaskGuid, actualCellId, actualFailed, actualFailureReason, actualResult := fakeTaskDB.CompleteTaskArgsForCall(0)
				Expect(actualTaskGuid).To(Equal(taskGuid))
				Expect(actualCellId).To(Equal(cellId))
				Expect(actualFailed).To(Equal(failed))
				Expect(actualFailureReason).To(Equal(failureReason))
				Expect(actualResult).To(Equal(result))
				Expect(err).NotTo(HaveOccurred())
			})

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