コード例 #1
0
func (reporter *ForwardingReporter) SpecDidComplete(specSummary *types.SpecSummary) {
	output, _ := reporter.outputInterceptor.StopInterceptingAndReturnOutput()
	reporter.outputInterceptor.StartInterceptingOutput()
	specSummary.CapturedOutput = output
	reporter.post("/SpecDidComplete", specSummary)
}
コード例 #2
0
		Context("When a spec completes", func() {
			BeforeEach(func() {
				specSummary.State = types.SpecStatePanicked
				reporter.SpecDidComplete(specSummary)
			})

			It("should POST the SpecSummary 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/SpecDidComplete"))
				Ω(poster.posts[1].bodyType).Should(Equal("application/json"))

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

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

	Context("When a suite ends", func() {
		BeforeEach(func() {
			reporter.SpecSuiteDidEnd(suiteSummary)
		})