var failer *Failer.Failer
	var node SuiteNode
	var codeLocation types.CodeLocation
	var innerCodeLocation types.CodeLocation
	var outcome bool
	var server *ghttp.Server

	BeforeEach(func() {
		server = ghttp.NewServer()
		codeLocation = codelocation.New(0)
		innerCodeLocation = codelocation.New(0)
		failer = Failer.New()
	})

	AfterEach(func() {
		server.Close()
	})

	newNode := func(bodyA interface{}, bodyB interface{}) SuiteNode {
		return NewSynchronizedBeforeSuiteNode(bodyA, bodyB, codeLocation, time.Millisecond, failer)
	}

	Describe("when not running in parallel", func() {
		Context("when all is well", func() {
			var data []byte
			BeforeEach(func() {
				data = nil

				node = newNode(func() []byte {
					return []byte("my data")
				}, func(d []byte) {
コード例 #2
0
			It("responds with correct body", func() {
				assertBodyEquals(resp.Body, RespBody)
			})

		})

		Context("when socket in reques URI is incorrect", func() {
			It("errors", func() {
				resp, err = client.Get("unix:///fake/socket.sock/_ping")
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring("Wrong unix socket"))
			})
		})

		AfterEach(func() {
			unixSocketServer.Close()
		})
	})

	Context("with no server listening", func() {
		BeforeEach(func() {
			socket = "/not/existing.sock"
			client = http.Client{Transport: New(socket)}
		})

		It("errors", func() {
			_, err := client.Get("unix:///not/existing.sock/_ping")
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring(fmt.Sprintf("dial unix %s: no such file or directory", socket)))
		})
	})