AfterEach(func() { commandregistry.Register(originalStart) commandregistry.Register(originalStop) }) Describe("requirements", func() { It("fails with usage when not provided exactly one arg", func() { requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) runCommand() Expect(ui.Outputs()).To(ContainSubstrings( []string{"Incorrect Usage", "Requires an argument"}, )) }) It("fails when not logged in", func() { requirementsFactory.NewApplicationRequirementReturns(applicationReq) requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) Expect(runCommand()).To(BeFalse()) }) It("fails when a space is not targeted", func() { requirementsFactory.NewApplicationRequirementReturns(applicationReq) requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) Expect(runCommand()).To(BeFalse()) }) }) Context("when logged in, targeting a space, and an app name is provided", func() { BeforeEach(func() { requirementsFactory.NewApplicationRequirementReturns(applicationReq)
Config: configRepo, RepoLocator: repoLocator, } cmd = &route.UnmapRoute{} cmd.SetDependency(deps, false) flagContext = flags.NewFlagContext(cmd.MetaData().Flags) factory = new(requirementsfakes.FakeFactory) loginRequirement = &passingRequirement{Name: "login-requirement"} factory.NewLoginRequirementReturns(loginRequirement) applicationRequirement = new(requirementsfakes.FakeApplicationRequirement) factory.NewApplicationRequirementReturns(applicationRequirement) fakeApplication := models.Application{} fakeApplication.GUID = "fake-app-guid" applicationRequirement.GetApplicationReturns(fakeApplication) domainRequirement = new(requirementsfakes.FakeDomainRequirement) factory.NewDomainRequirementReturns(domainRequirement) fakeDomain = models.DomainFields{ GUID: "fake-domain-guid", Name: "fake-domain-name", } domainRequirement.GetDomainReturns(fakeDomain) minAPIVersionRequirement = &passingRequirement{Name: "min-api-version-requirement"}