github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/requirements/number_arguments_test.go (about) 1 package requirements_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/cf/requirements" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("NumberArguments", func() { 11 It("returns an error if the number of arguments doesn't match", func() { 12 args := []string{"one", "two"} 13 numberArgumentsRequirement := NewNumberArguments(args, []string{"SPACE"}) 14 15 err := numberArgumentsRequirement.Execute() 16 Expect(err).To(MatchError(NumberArgumentsError{ExpectedArgs: []string{"SPACE"}})) 17 }) 18 19 It("returns nil if the number of arguments matches", func() { 20 args := []string{"one"} 21 numberArgumentsRequirement := NewNumberArguments(args, []string{"SPACE"}) 22 23 err := numberArgumentsRequirement.Execute() 24 Expect(err).NotTo(HaveOccurred()) 25 }) 26 })