Exemplo n.º 1
0
					},
					State: models.TaskStateRunning,
				}

				fakeBBS.TaskByGuidReturns(task, nil)

				expectedTask = receptor.TaskResponse{
					TaskGuid: task.TaskGuid,
					Domain:   task.Domain,
					Action:   task.Action,
					State:    receptor.TaskStateRunning,
				}
			})

			It("retrieves the task by the given guid", func() {
				_, guid := fakeBBS.TaskByGuidArgsForCall(0)
				Expect(guid).To(Equal("the-task-guid"))
			})

			It("gets the task", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusOK))

				var actualTask receptor.TaskResponse
				err := json.Unmarshal(responseRecorder.Body.Bytes(), &actualTask)
				Expect(err).NotTo(HaveOccurred())
				Expect(expectedTask).To(Equal(actualTask))
			})
		})
	})

	Describe("Delete", func() {