Пример #1
0
var _ = Describe("Context", func() {
	var logger log15.Logger
	var ctx *goa.Context

	BeforeEach(func() {
		gctx := context.Background()
		ctx = &goa.Context{Context: gctx, Logger: logger}
	})

	Describe("SetValue", func() {
		key := "answer"
		val := 42

		BeforeEach(func() {
			ctx.SetValue(key, val)
		})

		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}
		})