Context("When an example completes", func() { BeforeEach(func() { exampleSummary.State = types.ExampleStatePanicked reporter.ExampleDidComplete(exampleSummary) }) It("should POST the ExampleSummary to the Ginkgo server and include any intercepted output", func() { Ω(poster.posts).Should(HaveLen(2)) Ω(poster.posts[1].url).Should(Equal("http://127.0.0.1:7788/ExampleDidComplete")) Ω(poster.posts[1].bodyType).Should(Equal("application/json")) var summary *types.ExampleSummary err := json.Unmarshal(poster.posts[1].bodyContent, &summary) Ω(err).ShouldNot(HaveOccurred()) exampleSummary.CapturedOutput = interceptor.InterceptedOutput Ω(summary).Should(Equal(exampleSummary)) }) It("should stop intercepting output", func() { Ω(interceptor.DidStopInterceptingOutput).Should(BeTrue()) }) }) }) Context("When a suite ends", func() { BeforeEach(func() { reporter.SpecSuiteDidEnd(suiteSummary) }) It("should POST the SuiteSummary to the Ginkgo server", func() {
func (reporter *ForwardingReporter) ExampleDidComplete(exampleSummary *types.ExampleSummary) { output, _ := reporter.outputInterceptor.StopInterceptingAndReturnOutput() exampleSummary.CapturedOutput = output reporter.post("/ExampleDidComplete", exampleSummary) }