github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/command/flag/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("RoutePath", func() { 10 var routePath RoutePath 11 12 Describe("UnmarshalFlag", func() { 13 BeforeEach(func() { 14 routePath = RoutePath{} 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 })