) var _ = Describe("HelpCmd", func() { var ( commands CommandList ui *fakeui.FakeUI help Cmd ) BeforeEach(func() { commands = CommandList{ "simple": func() (Cmd, error) { meta := Meta{ Synopsis: "Simple command... sorted to the end of the list", } return fakecmd.NewFakeCommand("simple", meta), nil }, "complex": func() (Cmd, error) { meta := Meta{ Synopsis: "Complex command... has usage and env", Usage: "[arguments]", Env: map[string]MetaEnv{ "BOSH_ENV_VARIABLE1": { Example: "value", Default: "default", Description: "Sets some environment variable to a value", }, "BOSH_ENV_VARIABLE2": { Example: "something-else", Description: "Sets another environment variable", },
bicmd "github.com/cloudfoundry/bosh-init/cmd" fakebicmd "github.com/cloudfoundry/bosh-init/cmd/fakes" fakebiui "github.com/cloudfoundry/bosh-init/ui/fakes" ) var _ = Describe("Runner", func() { var ( runner *bicmd.Runner factory *fakebicmd.FakeFactory fakeCommand *fakebicmd.FakeCommand fakeStage *fakebiui.FakeStage ) BeforeEach(func() { fakeCommand = fakebicmd.NewFakeCommand("fake-command-name", bicmd.Meta{}) factory = &fakebicmd.FakeFactory{PresetCommand: fakeCommand} fakeStage = fakebiui.NewFakeStage() }) JustBeforeEach(func() { runner = bicmd.NewRunner(factory) }) Context("Run", func() { Context("valid args", func() { It("extracts command name from the arguments", func() { err := runner.Run(fakeStage, "fake-command-name", "/fake/manifest_path") Expect(err).ToNot(HaveOccurred()) Expect(factory.CommandName).To(Equal("fake-command-name")) })