taskLogger, taskGuid := fakeTaskDB.CancelTaskArgsForCall(0) Expect(taskLogger.SessionName()).To(ContainSubstring("cancel-task")) Expect(taskGuid).To(Equal("task-guid")) Expect(responseRecorder.Code).To(Equal(http.StatusOK)) response := &models.TaskLifecycleResponse{} err := response.Unmarshal(responseRecorder.Body.Bytes()) Expect(err).NotTo(HaveOccurred()) Expect(response.Error).To(BeNil()) }) }) Context("when desiring the task fails", func() { BeforeEach(func() { fakeTaskDB.CancelTaskReturns(models.ErrUnknownError) }) It("responds with an error", func() { Expect(responseRecorder.Code).To(Equal(http.StatusOK)) response := &models.TaskLifecycleResponse{} err := response.Unmarshal(responseRecorder.Body.Bytes()) Expect(err).NotTo(HaveOccurred()) Expect(response.Error).To(Equal(models.ErrUnknownError)) }) }) }) }) Describe("FailTask", func() {