github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/command/flag/v6_route_path_test.go (about) 1 package flag_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/command/flag" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 ) 8 9 var _ = Describe("V6RoutePath", func() { 10 var routePath V6RoutePath 11 12 Describe("UnmarshalFlag", func() { 13 BeforeEach(func() { 14 routePath = V6RoutePath{} 15 }) 16 17 When("passed a path beginning with a slash", func() { 18 It("sets the path", func() { 19 err := routePath.UnmarshalFlag("/banana") 20 Expect(err).ToNot(HaveOccurred()) 21 Expect(routePath.Path).To(Equal("/banana")) 22 }) 23 }) 24 25 When("passed a path that doesn't begin with a slash", func() { 26 It("prepends the path with a slash and sets it", func() { 27 err := routePath.UnmarshalFlag("banana") 28 Expect(err).ToNot(HaveOccurred()) 29 Expect(routePath.Path).To(Equal("/banana")) 30 }) 31 }) 32 }) 33 })