It("raises error when invalid flag is provided", func() { args := []string{ts.Port(), "list-apps", "--invalid_flag"} session, err := gexec.Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter) session.Wait() Expect(err).NotTo(HaveOccurred()) Expect(session).To(gbytes.Say("FAILED")) Expect(session).To(gbytes.Say("invalid_flag")) }) }) Context("Running the command", func() { Context("Curling v2/apps endpoint", func() { BeforeEach(func() { rpcHandlers.ApiEndpointStub = func(_ string, retVal *string) error { *retVal = "api.example.com" return nil } }) It("shows the endpoint it is curling", func() { args := []string{ts.Port(), "list-apps"} session, err := gexec.Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter) session.Wait() Expect(err).NotTo(HaveOccurred()) Expect(session).To(gbytes.Say("api.example.com/v2/apps")) }) Context("when ApiEndpoint() returns an error", func() { BeforeEach(func() { rpcHandlers.ApiEndpointStub = func(_ string, retVal *string) error { *retVal = ""