Exemplo n.º 1
0
func (reporter *ForwardingReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) {
	output, _ := reporter.outputInterceptor.StopInterceptingAndReturnOutput()
	reporter.outputInterceptor.StartInterceptingOutput()
	setupSummary.CapturedOutput = output
	reporter.post("/AfterSuiteDidRun", setupSummary)
}
		})

		It("should stop, then start intercepting output", func() {
			Ω(interceptor.DidStopInterceptingOutput).Should(BeTrue())
			Ω(interceptor.DidStartInterceptingOutput).Should(BeTrue())
		})

		It("should POST the SetupSummary to the Ginkgo server", func() {
			Ω(poster.posts).Should(HaveLen(1))
			Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/BeforeSuiteDidRun"))
			Ω(poster.posts[0].bodyType).Should(Equal("application/json"))

			var summary *types.SetupSummary
			err := json.Unmarshal(poster.posts[0].bodyContent, &summary)
			Ω(err).ShouldNot(HaveOccurred())
			setupSummary.CapturedOutput = interceptor.InterceptedOutput
			Ω(summary).Should(Equal(setupSummary))
		})
	})

	Context("when an AfterSuite completes", func() {
		BeforeEach(func() {
			reporter.AfterSuiteDidRun(setupSummary)
		})

		It("should stop, then start intercepting output", func() {
			Ω(interceptor.DidStopInterceptingOutput).Should(BeTrue())
			Ω(interceptor.DidStartInterceptingOutput).Should(BeTrue())
		})

		It("should POST the SetupSummary to the Ginkgo server", func() {