예제 #1
0
파일: service_test.go 프로젝트: is00hcw/goa
	const appName = "foo"
	var s goa.Service

	BeforeEach(func() {
		s = goa.New(appName)
		s.SetDecoder(goa.JSONDecoderFactory(), true, "*/*")
		s.SetEncoder(goa.JSONEncoderFactory(), true, "*/*")
	})

	Describe("New", func() {
		It("creates an application", func() {
			Ω(s).ShouldNot(BeNil())
		})

		It("initializes the application fields", func() {
			Ω(s.Name()).Should(Equal(appName))
			Ω(s).Should(BeAssignableToTypeOf(&goa.Application{}))
			app, _ := s.(*goa.Application)
			Ω(app.Name()).Should(Equal(appName))
			Ω(app.Logger).ShouldNot(BeNil())
			Ω(app.ServeMux).ShouldNot(BeNil())
		})
	})

	Describe("Use", func() {
		Context("with a valid middleware", func() {
			var m goa.Middleware

			BeforeEach(func() {
				m = middleware.RequestID()
			})