Пример #1
0
		It("sets the value in the context.Context", func() {
			v := ctx.Value(key)
			Ω(v).Should(Equal(val))
		})
	})

	Describe("SetResponseWriter", func() {
		var rw http.ResponseWriter

		BeforeEach(func() {
			rw = &TestResponseWriter{Status: 42}
		})

		It("sets the response writer and returns the previous one", func() {
			rwo := ctx.SetResponseWriter(rw)
			Ω(rwo).Should(BeNil())
			rwo = ctx.SetResponseWriter(&TestResponseWriter{Status: 43})
			Ω(rwo).ShouldNot(BeNil())
			Ω(rwo).Should(BeAssignableToTypeOf(&TestResponseWriter{}))
			trw := rwo.(*TestResponseWriter)
			Ω(trw.Status).Should(Equal(42))
		})
	})

	Describe("Request", func() {
		It("returns nil if not initialized", func() {
			Ω(ctx.Request()).Should(BeNil())
		})
	})