Пример #1
0
				}, nil)
			})

			Context("when a domain query param is provided", func() {
				It("gets all tasks", func() {
					var tasks []receptor.TaskResponse

					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))
					err = json.Unmarshal(responseRecorder.Body.Bytes(), &tasks)
					Expect(err).NotTo(HaveOccurred())

					_, actualDomain := fakeBBS.TasksByDomainArgsForCall(0)
					Expect(actualDomain).To(Equal("domain-1"))
					expectedTasks := []receptor.TaskResponse{
						{
							TaskGuid: domain1Task.TaskGuid,
							Domain:   domain1Task.Domain,
							Action:   domain1Task.Action,
							State:    receptor.TaskStatePending,
						},
					}
					Expect(tasks).To(Equal(expectedTasks))
				})
			})

			Context("when a domain query param is not provided", func() {
				It("gets all tasks", func() {