Expect(actualTaskDef).To(Equal(taskDef)) Expect(actualTaskGuid).To(Equal(taskGuid)) Expect(actualDomain).To(Equal(domain)) 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.DesireTaskReturns(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("StartTask", func() { Context("when the start is successful", func() {