"foo": 1, "bar": 2, } }) Context("when the metrics fetch succesfully", func() { It("should return them", func() { context := metricsServer.Emit() Ω(context.Metrics).Should(ContainElement(instrumentation.Metric{Name: "foo", Value: float64(1.0)})) Ω(context.Metrics).Should(ContainElement(instrumentation.Metric{Name: "bar", Value: float64(2.0)})) }) }) Context("when the metrics fail to fetch", func() { BeforeEach(func() { metricsAccountant.GetMetricsError = errors.New("oops") }) It("should not return them", func() { context := metricsServer.Emit() Ω(context.Metrics).ShouldNot(ContainElement(instrumentation.Metric{Name: "foo", Value: float64(1.0)})) Ω(context.Metrics).ShouldNot(ContainElement(instrumentation.Metric{Name: "bar", Value: float64(2.0)})) }) }) }) Describe("app metrics", func() { It("should have a name", func() { context := metricsServer.Emit() Ω(context.Name).Should(Equal("HM9000")) })