keepGoing = cb(s) if !keepGoing { break } } return nil } } BeforeEach(func() { ui = &testterm.FakeUI{} orgRepo = &fake_org.FakeOrganizationRepository{} spaceRepo = &testapi.FakeSpaceRepository{} requirementsFactory = new(testreq.FakeReqFactory) config = testconfig.NewRepositoryWithDefaults() requirementsFactory.ApiEndpointSuccess = true }) var callTarget = func(args []string) bool { return testcmd.RunCliCommand("target", args, requirementsFactory, updateCommandDependency, false) } It("fails with usage when called with an argument but no flags", func() { callTarget([]string{"some-argument"}) Expect(ui.Outputs).To(ContainSubstrings( []string{"Incorrect Usage", "No argument required"}, )) }) Describe("when there is no api endpoint set", func() { BeforeEach(func() {