func (watcher *Watcher) emitMessages(logger lager.Logger, messagesToEmit routing_table.MessagesToEmit) { if watcher.emitter != nil { logger.Debug("emitting-messages", lager.Data{"messages": messagesToEmit}) watcher.emitter.Emit(messagesToEmit) routesRegistered.Add(messagesToEmit.RouteRegistrationCount()) routesUnregistered.Add(messagesToEmit.RouteUnregistrationCount()) } }
}) It("adds the number of hostnames in each route message", func() { Expect(messagesToEmit.RouteRegistrationCount()).To(BeEquivalentTo(0)) }) }) }) Describe("RouteUnregistrationCount", func() { Context("when there are unregistration messages", func() { BeforeEach(func() { messagesToEmit.UnregistrationMessages = messages1 }) It("adds the number of hostnames in each route message", func() { Expect(messagesToEmit.RouteUnregistrationCount()).To(BeEquivalentTo(5)) }) }) Context("when registration messages is nil", func() { BeforeEach(func() { messagesToEmit.RegistrationMessages = messages1 messagesToEmit.UnregistrationMessages = nil }) It("adds the number of hostnames in each route message", func() { Expect(messagesToEmit.RouteUnregistrationCount()).To(BeEquivalentTo(0)) }) }) }) })