cb(0) } process = ifrit.Invoke(bbsWatcher) }) It("does not request a watch", func() { Consistently(db.WatchForDesiredLRPChangesCallCount).Should(BeZero()) Consistently(db.WatchForActualLRPChangesCallCount).Should(BeZero()) }) Context("and then the hub reports a subscriber", func() { var callback func(int) BeforeEach(func() { Expect(hub.RegisterCallbackCallCount()).To(Equal(1)) callback = hub.RegisterCallbackArgsForCall(0) callback(1) }) It("requests watches", func() { Eventually(db.WatchForDesiredLRPChangesCallCount).Should(Equal(1)) Eventually(db.WatchForActualLRPChangesCallCount).Should(Equal(1)) }) Context("and then the hub reports two subscribers", func() { BeforeEach(func() { callback(2) }) It("does not request more watches", func() { Eventually(db.WatchForDesiredLRPChangesCallCount).Should(Equal(1))