flagContext.Parse("target") cmd.Execute(flagContext) Expect(fakeUI.SayCallCount()).To(Equal(1)) output, _ := fakeUI.SayArgsForCall(0) Expect(output).To(ContainSubstring("target - Set or view the targeted org or space")) }) }) Context("When the command does not exists", func() { It("prints the usage help for the command", func() { flagContext.Parse("bad-command") cmd.Execute(flagContext) Expect(fakeUI.FailedCallCount()).To(Equal(1)) output, _ := fakeUI.FailedArgsForCall(0) Expect(output).To(ContainSubstring("'bad-command' is not a registered command. See 'cf help'")) }) }) }) Context("when a command provided is a plugin command", func() { BeforeEach(func() { m := make(map[string]pluginconfig.PluginMetadata) m["fakePlugin"] = pluginconfig.PluginMetadata{ Commands: []plugin.Command{ { Name: "fakePluginCmd1", Alias: "fpc1", HelpText: "help text here", UsageDetails: plugin.Usage{