github.com/cloudfoundry/cli@v7.1.0+incompatible/integration/shared/plugin/help_test.go (about)

     1  package plugin
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/ginkgo/extensions/table"
     7  	. "github.com/onsi/gomega"
     8  	. "github.com/onsi/gomega/gbytes"
     9  	. "github.com/onsi/gomega/gexec"
    10  )
    11  
    12  var _ = Describe("help", func() {
    13  	BeforeEach(func() {
    14  		installTestPlugin()
    15  	})
    16  
    17  	AfterEach(func() {
    18  		uninstallTestPlugin()
    19  	})
    20  
    21  	It("displays the plugin commands in master help", func() {
    22  		session := helpers.CF("help")
    23  		Eventually(session).Should(Say("TestPluginCommandWithAlias"))
    24  		Eventually(session).Should(Exit(0))
    25  	})
    26  
    27  	DescribeTable("displays individual plugin help",
    28  		func(helpCommand ...string) {
    29  			session := helpers.CF(helpCommand...)
    30  			Eventually(session).Should(Say("TestPluginCommandWithAlias"))
    31  			Eventually(session).Should(Say("This is my plugin help test. Banana."))
    32  			Eventually(session).Should(Say("I R Usage"))
    33  			Eventually(session).Should(Say(`--dis-flag\s+is a flag`))
    34  			Eventually(session).Should(Exit(0))
    35  		},
    36  
    37  		Entry("when passed to help", "help", "TestPluginCommandWithAlias"),
    38  		Entry("when when passed -h", "TestPluginCommandWithAlias", "-h"),
    39  		Entry("when when passed --help", "TestPluginCommandWithAlias", "--help"),
    40  	)
    41  })