예제 #1
0
			sentOn = 0
			err = nil
			storeSetErrInjector = nil
		})

		Context("and it is not time to send the message yet", func() {
			BeforeEach(func() {
				timeProvider.TimeToProvide = time.Unix(129, 0)
			})

			It("should not error", func() {
				Ω(err).ShouldNot(HaveOccurred())
			})

			It("should not send the messages", func() {
				Ω(messageBus.PublishedMessages("hm9000.start")).Should(HaveLen(0))
			})

			It("should not increment the metrics", func() {
				Ω(metricsAccountant.IncrementedStarts).Should(BeEmpty())
			})

			It("should leave the messages in the queue", func() {
				messages, _ := store.GetPendingStartMessages()
				Ω(messages).Should(HaveLen(1))
			})
		})

		Context("and it is time to send the message", func() {
			BeforeEach(func() {
				timeProvider.TimeToProvide = time.Unix(130, 0)