anotherApp = NewAppFixture() anotherApp.DeaGuid = app.DeaGuid storeAdapter = fakestoreadapter.New() store = storepackage.NewStore(conf, storeAdapter, fakelogger.NewFakeLogger()) messageBus = fakeyagnats.New() logger = fakelogger.NewFakeLogger() usageTracker = fakeusagetracker.New() usageTracker.UsageToReturn = 0.7 metricsAccountant = fakemetricsaccountant.New() listener = New(conf, messageBus, store, usageTracker, metricsAccountant, timeProvider, logger) listener.Start() Eventually(func() interface{} { return timeProvider.TickerChannelFor(HeartbeatSyncTimer) }).ShouldNot(BeZero()) }) forceHeartbeatSync := func() { //This first message, triggers the iteration we care about in a goroutine timeProvider.TickerChannelFor(HeartbeatSyncTimer) <- time.Now() //This blocks until the goroutine completes. yes, it does trigger the next round, but that should be a noop timeProvider.TickerChannelFor(HeartbeatSyncTimer) <- time.Now() } It("should subscribe to the dea.heartbeat subject", func() { Ω(messageBus.Subscriptions).Should(HaveKey("dea.heartbeat")) Ω(messageBus.Subscriptions["dea.heartbeat"]).Should(HaveLen(1)) })