コード例 #1
0
			})
		})
	})

	Describe("SpecDidComplete", func() {
		JustBeforeEach(func() {
			reporter.SpecDidComplete(spec)
		})

		BeforeEach(func() {
			spec = &types.SpecSummary{}
		})

		Context("When the spec passed", func() {
			BeforeEach(func() {
				spec.State = types.SpecStatePassed
			})

			Context("When the spec was a measurement", func() {
				BeforeEach(func() {
					spec.IsMeasurement = true
				})

				It("should announce the measurement", func() {
					Ω(stenographer.Calls()[0]).Should(Equal(call("AnnounceSuccesfulMeasurement", spec, false)))
				})
			})

			Context("When the spec is slow", func() {
				BeforeEach(func() {
					spec.RunTime = time.Second
コード例 #2
0
		})

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

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

		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))
			})