It("does not pass requirements if org is not targeted", func() { requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) targetedOrgReq := new(requirementsfakes.FakeTargetedOrgRequirement) targetedOrgReq.ExecuteReturns(errors.New("no org targeted")) requirementsFactory.NewTargetedOrgRequirementReturns(targetedOrgReq) Expect(runCommand("my-space")).To(BeFalse()) }) It("does not pass requirements if space does not exist", func() { requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement)) spaceReq := new(requirementsfakes.FakeSpaceRequirement) spaceReq.ExecuteReturns(errors.New("no space")) requirementsFactory.NewSpaceRequirementReturns(spaceReq) Expect(runCommand("my-space")).To(BeFalse()) }) }) Describe("allow-space-ssh", func() { var space models.Space BeforeEach(func() { requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement)) space = models.Space{} space.Name = "the-space-name" space.GUID = "the-space-guid"
RepoLocator: repoLocator, } cmd = &route.CreateRoute{} cmd.SetDependency(deps, false) flagContext = flags.NewFlagContext(cmd.MetaData().Flags) factory = new(requirementsfakes.FakeFactory) spaceRequirement = new(requirementsfakes.FakeSpaceRequirement) space := models.Space{} space.GUID = "space-guid" space.Name = "space-name" spaceRequirement.GetSpaceReturns(space) factory.NewSpaceRequirementReturns(spaceRequirement) domainRequirement = new(requirementsfakes.FakeDomainRequirement) domainRequirement.GetDomainReturns(models.DomainFields{ GUID: "domain-guid", Name: "domain-name", }) factory.NewDomainRequirementReturns(domainRequirement) minAPIVersionRequirement = &passingRequirement{} factory.NewMinAPIVersionRequirementReturns(minAPIVersionRequirement) }) Describe("Requirements", func() { Context("when not provided exactly two args", func() { BeforeEach(func() {