var ( hub events.Hub ) BeforeEach(func() { hub = events.NewHub() }) Describe("RegisterCallback", func() { Context("when registering the callback", func() { var eventSource events.EventSource var counts chan int BeforeEach(func() { var err error eventSource, err = hub.Subscribe() Expect(err).NotTo(HaveOccurred()) counts = make(chan int, 1) cbCounts := counts hub.RegisterCallback(func(count int) { cbCounts <- count }) }) It("calls the callback immediately with the current subscriber count", func() { Eventually(counts).Should(Receive(Equal(1))) }) Context("when adding another subscriber", func() { BeforeEach(func() {