github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/integration/isolated/curl_command_test.go (about) 1 package isolated 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 . "github.com/onsi/gomega/gbytes" 8 . "github.com/onsi/gomega/gexec" 9 ) 10 11 var _ = Describe("error handling", func() { 12 Describe("exit codes", func() { 13 Context("when an unknown command is invoked", func() { 14 It("exits 1", func() { 15 session := helpers.CF("some-command-that-should-never-actually-be-a-real-thing-i-can-use") 16 17 Eventually(session).Should(Exit(1)) 18 Eventually(session).Should(Say("not a registered command")) 19 }) 20 }) 21 22 Context("when a known command is invoked with an invalid option", func() { 23 It("exits 1", func() { 24 session := helpers.CF("push", "--crazy") 25 26 Eventually(session).Should(Exit(1)) 27 }) 28 }) 29 }) 30 31 Describe("incorrect usage", func() { 32 Context("when a command is invoked with an invalid options", func() { 33 It("does not display requirement errors twice", func() { 34 session := helpers.CF("space") 35 36 Eventually(session).Should(Exit(1)) 37 Expect(session.Err).To(Say("the required argument `SPACE` was not provided")) 38 Expect(session.Err).NotTo(Say("the required argument `SPACE` was not provided")) 39 Expect(session.Out).NotTo(Say("the required argument `SPACE` was not provided")) 40 }) 41 }) 42 }) 43 })