github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/command/flag/binding_name_test.go (about) 1 package flag_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/command/flag" 5 flags "github.com/jessevdk/go-flags" 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("BindingName", func() { 11 var bindingName BindingName 12 13 BeforeEach(func() { 14 bindingName = BindingName{} 15 }) 16 17 When("the value provided to the --binding-name flag is the empty string", func() { 18 It("returns a ErrMarshal error that the binding name must be greater than 1 character long", func() { 19 Expect(bindingName.UnmarshalFlag("")).To(MatchError(&flags.Error{ 20 Type: flags.ErrMarshal, 21 Message: "--binding-name must be at least 1 character in length", 22 })) 23 }) 24 }) 25 26 When("the value provided to the --binding-name flag is greater than 0 characters long", func() { 27 It("stores the binding name and does not return an error", func() { 28 err := bindingName.UnmarshalFlag("some-name") 29 Expect(err).NotTo(HaveOccurred()) 30 Expect(bindingName.Value).To(Equal("some-name")) 31 }) 32 }) 33 })