コード例 #1
0
				Ω(thingsThatRan()).Should(Equal([]string{"A", "B"}))
			})

			It("should report failure", func() {
				Ω(outcome).Should(BeFalse())
				Ω(node.Passed()).Should(BeFalse())
				Ω(node.Summary().State).Should(Equal(types.SpecStateFailed))
			})
		})
	})

	Context("when running in parallel", func() {
		Context("as the first node", func() {
			BeforeEach(func() {
				server.AppendHandlers(ghttp.CombineHandlers(
					ghttp.VerifyRequest("GET", "/RemoteAfterSuiteData"),
					func(writer http.ResponseWriter, request *http.Request) {
						ranThing("Request1")
					},
					ghttp.RespondWithJSONEncoded(200, types.RemoteAfterSuiteData{false}),
				), ghttp.CombineHandlers(
					ghttp.VerifyRequest("GET", "/RemoteAfterSuiteData"),
					func(writer http.ResponseWriter, request *http.Request) {
						ranThing("Request2")
					},
					ghttp.RespondWithJSONEncoded(200, types.RemoteAfterSuiteData{false}),
				), ghttp.CombineHandlers(
					ghttp.VerifyRequest("GET", "/RemoteAfterSuiteData"),
					func(writer http.ResponseWriter, request *http.Request) {
						ranThing("Request3")
					},
コード例 #2
0
		var parallelNode, parallelTotal int
		BeforeEach(func() {
			ranB = false
			parallelNode, parallelTotal = 1, 3
		})

		Context("as the first node, it runs A", func() {
			var expectedState types.RemoteBeforeSuiteData

			BeforeEach(func() {
				parallelNode, parallelTotal = 1, 3
			})

			JustBeforeEach(func() {
				server.AppendHandlers(ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/BeforeSuiteState"),
					ghttp.VerifyJSONRepresenting(expectedState),
				))

				outcome = node.Run(parallelNode, parallelTotal, server.URL())
			})

			Context("when A succeeds", func() {
				BeforeEach(func() {
					expectedState = types.RemoteBeforeSuiteData{[]byte("my data"), types.RemoteBeforeSuiteStatePassed}

					node = newNode(func() []byte {
						return []byte("my data")
					}, func([]byte) {
						ranB = true
					})