github.com/jghiloni/cli@v6.28.1-0.20170628223758-0ce05fe032a2+incompatible/command/flag/security_group_lifecycle_test.go (about)

     1  package flag_test
     2  
     3  import (
     4  	. "code.cloudfoundry.org/cli/command/flag"
     5  	flags "github.com/jessevdk/go-flags"
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/ginkgo/extensions/table"
     8  	. "github.com/onsi/gomega"
     9  )
    10  
    11  var _ = Describe("SecurityGroupLifecycle", func() {
    12  	var group SecurityGroupLifecycle
    13  
    14  	Describe("Complete", func() {
    15  		DescribeTable("returns list of completions",
    16  			func(prefix string, matches []flags.Completion) {
    17  				completions := group.Complete(prefix)
    18  				Expect(completions).To(Equal(matches))
    19  			},
    20  
    21  			Entry("completes to 'staging' when passed 's'", "s",
    22  				[]flags.Completion{{Item: "staging"}}),
    23  			Entry("completes to 'running' when passed 'r'", "r",
    24  				[]flags.Completion{{Item: "running"}}),
    25  			Entry("completes to 'staging' when passed 'sT'", "sT",
    26  				[]flags.Completion{{Item: "staging"}}),
    27  			Entry("completes to 'running' when passed 'Ru'", "Ru",
    28  				[]flags.Completion{{Item: "running"}}),
    29  			Entry("returns 'staging' and 'running' when passed nothing", "",
    30  				[]flags.Completion{{Item: "staging"}, {Item: "running"}}),
    31  			Entry("completes to nothing when passed 'wut'", "wut",
    32  				[]flags.Completion{}),
    33  		)
    34  	})
    35  })