github.com/brycereitano/goa@v0.0.0-20170315073847-8ffa6c85e265/goagen/gen_swagger/generator_test.go (about)

     1  package genswagger_test
     2  
     3  import (
     4  	"github.com/goadesign/goa/design"
     5  	"github.com/goadesign/goa/goagen/gen_swagger"
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("NewGenerator", func() {
    11  	var generator *genswagger.Generator
    12  
    13  	var args = struct {
    14  		api    *design.APIDefinition
    15  		outDir string
    16  	}{
    17  		api: &design.APIDefinition{
    18  			Name: "test api",
    19  		},
    20  		outDir: "out_dir",
    21  	}
    22  
    23  	Context("with options all options set", func() {
    24  		BeforeEach(func() {
    25  
    26  			generator = genswagger.NewGenerator(
    27  				genswagger.API(args.api),
    28  				genswagger.OutDir(args.outDir),
    29  			)
    30  		})
    31  
    32  		It("has all public properties set with expected value", func() {
    33  			Ω(generator).ShouldNot(BeNil())
    34  			Ω(generator.API.Name).Should(Equal(args.api.Name))
    35  			Ω(generator.OutDir).Should(Equal(args.outDir))
    36  		})
    37  	})
    38  })