github.com/geofffranks/garden-linux@v0.0.0-20160715111146-26c893169cfa/pkg/vars/vars_test.go (about)

     1  package vars_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/garden-linux/pkg/vars"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("Vars", func() {
    10  	Describe("when set is called", func() {
    11  
    12  		var sl *vars.StringList
    13  
    14  		BeforeEach(func() {
    15  			sl = &vars.StringList{}
    16  			Expect(sl.Set("foo")).To(Succeed())
    17  			Expect(sl.Set("bar")).To(Succeed())
    18  		})
    19  
    20  		It("adds the value to the list", func() {
    21  			Expect(sl.List).To(ConsistOf("foo", "bar"))
    22  		})
    23  
    24  		It("stringifies with commas", func() {
    25  			Expect(sl.String()).To(Equal("foo, bar"))
    26  		})
    27  
    28  		It("returns the list from Get()", func() {
    29  			Expect(sl.Get()).To(Equal([]string{"foo", "bar"}))
    30  		})
    31  	})
    32  })