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

					Expect(fakeClient.TasksByDomainCallCount()).To(Equal(1))
					actualDomain := fakeClient.TasksByDomainArgsForCall(0)
					Expect(actualDomain).To(Equal("domain-1"))

					expectedTasks := []receptor.TaskResponse{
						serialization.TaskToResponse(domain1Task),
					}
					Expect(tasks).To(ConsistOf(expectedTasks))
				})
			})

			Context("when a domain query param is not provided", func() {
				It("gets all tasks", func() {
					handler.GetAll(responseRecorder, newTestRequest(""))
					Expect(responseRecorder.Code).To(Equal(http.StatusOK))