BeforeEach(func() { domains = []string{"domain-a", "domain-b"} }) JustBeforeEach(func() { handler.GetAll(responseRecorder, newTestRequest("")) }) Context("when reading domains from BBS succeeds", func() { BeforeEach(func() { fakeBBS.DomainsReturns(domains, nil) }) It("call the BBS to retrieve the domains", func() { Expect(fakeBBS.DomainsCallCount()).To(Equal(1)) }) It("responds with 200 Status OK", func() { Expect(responseRecorder.Code).To(Equal(http.StatusOK)) }) It("returns a list of domains", func() { response := []string{} err := json.Unmarshal(responseRecorder.Body.Bytes(), &response) Expect(err).NotTo(HaveOccurred()) Expect(response).To(ConsistOf(domains)) }) })