コード例 #1
0
ファイル: generator_test.go プロジェクト: stuartweir/goa
				Ω(err).ShouldNot(HaveOccurred())
			}
		} else {
			designPackage = nil
		}
		m = &meta.Generator{
			Genfunc: genfunc,
			Imports: []*codegen.ImportSpec{codegen.SimpleImport(designPackagePath)},
		}
		codegen.Debug = debug
		codegen.OutputDir = outputDir
		compiledFiles, compileError = m.Generate()
	})

	AfterEach(func() {
		designWorkspace.Delete()
		outputWorkspace.Delete()
	})

	Context("with no GOPATH environment variable", func() {
		var gopath string

		BeforeEach(func() {
			gopath = os.Getenv("GOPATH")
			os.Setenv("GOPATH", "")
		})

		AfterEach(func() {
			os.Setenv("GOPATH", gopath)
		})
コード例 #2
0
ファイル: generator_test.go プロジェクト: on99/goa
	BeforeEach(func() {
		var err error
		workspace, err = codegen.NewWorkspace("test")
		Ω(err).ShouldNot(HaveOccurred())
		outDir, err = ioutil.TempDir(filepath.Join(workspace.Path, "src"), "")
		Ω(err).ShouldNot(HaveOccurred())
		os.Args = []string{"goagen", "--out=" + outDir, "--design=foo"}
	})

	JustBeforeEach(func() {
		files, genErr = genapp.Generate(design.Design)
	})

	AfterEach(func() {
		workspace.Delete()
	})

	Context("with a dummy API", func() {
		BeforeEach(func() {
			design.Design = &design.APIDefinition{
				APIVersionDefinition: &design.APIVersionDefinition{
					Name:        "test api",
					Title:       "dummy API with no resource",
					Description: "I told you it's dummy",
				},
			}
		})

		It("generates correct empty files", func() {
			Ω(genErr).Should(BeNil())