Context("when reading tasks from BBS succeeds", func() { var domain1Task, domain2Task *models.Task BeforeEach(func() { domain1Task = model_helpers.NewValidTask("task-guid-1") domain1Task.Domain = "domain-1" domain2Task = model_helpers.NewValidTask("task-guid-2") domain2Task.Domain = "domain-2" fakeClient.TasksReturns([]*models.Task{ domain1Task, domain2Task, }, nil) fakeClient.TasksByDomainReturns([]*models.Task{ domain1Task, }, nil) }) Context("when a domain query param is provided", func() { It("gets all tasks", func() { request, err := http.NewRequest("", "http://example.com?domain=domain-1", nil) Expect(err).NotTo(HaveOccurred()) handler.GetAll(responseRecorder, request) Expect(responseRecorder.Code).To(Equal(http.StatusOK)) var tasks []receptor.TaskResponse err = json.Unmarshal(responseRecorder.Body.Bytes(), &tasks) Expect(err).NotTo(HaveOccurred())