Exemplo n.º 1
0
	})

	Describe("CancelTask", func() {
		var (
			request *http.Request
			cellID  string
		)

		BeforeEach(func() {
			requestBody = &models.TaskGuidRequest{
				TaskGuid: "task-guid",
			}

			task := model_helpers.NewValidTask("hi-bob")
			cellID = "the-cell"
			fakeTaskDB.CancelTaskReturns(task, cellID, nil)

			request = newTestRequest(requestBody)
		})

		JustBeforeEach(func() {
			handler.CancelTask(responseRecorder, request)
			Expect(responseRecorder.Code).To(Equal(http.StatusOK))
		})

		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)
				})