github.com/elopio/cli@v6.21.2-0.20160902224010-ea909d1fdb2f+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/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", 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.Version = "5.0.0" 37 cf.Name = "my-special-cf" 38 cf.BuiltOnDate = "2016-02-29" 39 }) 40 41 It("prints the version", func() { 42 cmd.Execute(flagContext) 43 44 Expect(ui.Outputs()).To(Equal([]string{ 45 "my-special-cf version 5.0.0-2016-02-29", 46 })) 47 }) 48 }) 49 })