Exemplo n.º 1
0
			Ω(poster.posts[0].url).Should(Equal("http://127.0.0.1:7788/ExampleWillRun"))
			Ω(poster.posts[0].bodyType).Should(Equal("application/json"))

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

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

		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))
			})
Exemplo n.º 2
0
			})
		})
	})

	Describe("ExampleDidComplete", func() {
		JustBeforeEach(func() {
			reporter.ExampleDidComplete(example)
		})

		BeforeEach(func() {
			example = &types.ExampleSummary{}
		})

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

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

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

			Context("When the example is slow", func() {
				BeforeEach(func() {
					example.RunTime = time.Second