code.cloudfoundry.org/cli@v7.1.0+incompatible/cf/commands/version_test.go (about) 1 package commands_test 2 3 import ( 4 "code.cloudfoundry.org/cli/cf/commandregistry" 5 "code.cloudfoundry.org/cli/cf/commands" 6 "code.cloudfoundry.org/cli/cf/flags" 7 8 testterm "code.cloudfoundry.org/cli/cf/util/testhelpers/terminal" 9 10 "code.cloudfoundry.org/cli/cf" 11 . "github.com/onsi/ginkgo" 12 . "github.com/onsi/gomega" 13 ) 14 15 var _ = Describe("version Command", func() { 16 var ( 17 ui *testterm.FakeUI 18 cmd commandregistry.Command 19 ) 20 21 BeforeEach(func() { 22 ui = &testterm.FakeUI{} 23 24 deps := commandregistry.Dependency{ 25 UI: ui, 26 } 27 28 cmd = &commands.Version{} 29 cmd.SetDependency(deps, false) 30 }) 31 32 Describe("Execute", func() { 33 var flagContext flags.FlagContext 34 35 BeforeEach(func() { 36 cf.Name = "my-special-cf" 37 }) 38 39 It("prints the version", func() { 40 cmd.Execute(flagContext) 41 42 Expect(ui.Outputs()).To(Equal([]string{ 43 "my-special-cf version 0.0.0-unknown-version", 44 })) 45 }) 46 }) 47 })