Exemplo n.º 1
0
		specSummary = &types.SpecSummary{
			State:          types.SpecStatePassed,
			CapturedOutput: "SpecOutput",
		}
	})

	call := func(method string, args ...interface{}) st.FakeStenographerCall {
		return st.NewFakeStenographerCall(method, args...)
	}

	beginSuite := func() {
		stenographer.Reset()
		aggregator.SpecSuiteWillBegin(ginkgoConfig2, suiteSummary2)
		aggregator.SpecSuiteWillBegin(ginkgoConfig1, suiteSummary1)
		Eventually(func() interface{} {
			return len(stenographer.Calls())
		}).Should(BeNumerically(">=", 3))
	}

	Describe("Announcing the beginning of the suite", func() {
		Context("When one of the parallel-suites starts", func() {
			BeforeEach(func() {
				aggregator.SpecSuiteWillBegin(ginkgoConfig2, suiteSummary2)
			})

			It("should be silent", func() {
				Consistently(func() interface{} { return stenographer.Calls() }).Should(BeEmpty())
			})
		})

		Context("once all of the parallel-suites have started", func() {
			ginkgoConfig = config.GinkgoConfigType{
				RandomSeed:        1138,
				RandomizeAllSpecs: true,
			}
		})

		Context("when a serial (non-parallel) suite begins", func() {
			BeforeEach(func() {
				ginkgoConfig.ParallelTotal = 1

				reporter.SpecSuiteWillBegin(ginkgoConfig, suite)
			})

			It("should announce the suite, then announce the number of specs", func() {
				Ω(stenographer.Calls()).Should(HaveLen(2))
				Ω(stenographer.Calls()[0]).Should(Equal(call("AnnounceSuite", "A Sweet Suite", ginkgoConfig.RandomSeed, true, false)))
				Ω(stenographer.Calls()[1]).Should(Equal(call("AnnounceNumberOfSpecs", 8, 10, false)))
			})
		})

		Context("when a parallel suite begins", func() {
			BeforeEach(func() {
				ginkgoConfig.ParallelTotal = 2
				ginkgoConfig.ParallelNode = 1
				suite.NumberOfSpecsBeforeParallelization = 20

				reporter.SpecSuiteWillBegin(ginkgoConfig, suite)
			})

			It("should announce the suite, announce that it's a parallel run, then announce the number of specs", func() {