github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/integration/shared/isolated/version_command_test.go (about)

     1  package isolated
     2  
     3  import (
     4  	"strings"
     5  
     6  	"code.cloudfoundry.org/cli/integration/helpers"
     7  
     8  	"github.com/blang/semver"
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/ginkgo/extensions/table"
    11  	. "github.com/onsi/gomega"
    12  	. "github.com/onsi/gomega/gbytes"
    13  	. "github.com/onsi/gomega/gexec"
    14  )
    15  
    16  var _ = Describe("version command", func() {
    17  	DescribeTable("displays version",
    18  		func(arg string) {
    19  			session := helpers.CF(arg)
    20  			Eventually(session).Should(Exit(0))
    21  			output := string(session.Out.Contents())
    22  			version := strings.Split(output, " ")[2]
    23  			versionNumber := strings.Split(version, "+")[0]
    24  			_, err := semver.Make(versionNumber)
    25  			Expect(err).To(Not(HaveOccurred()))
    26  			Eventually(session).ShouldNot(Say("cf version 0.0.0-unknown-version"))
    27  		},
    28  
    29  		Entry("when passed version", "version"),
    30  		Entry("when passed -v", "-v"),
    31  		Entry("when passed --version", "--version"),
    32  	)
    33  })