BeforeEach(func() { requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement)) space = models.Space{} space.Name = "the-space-name" space.GUID = "the-space-guid" spaceReq := new(requirementsfakes.FakeSpaceRequirement) spaceReq.GetSpaceReturns(space) requirementsFactory.NewSpaceRequirementReturns(spaceReq) }) Context("when allow_ssh is already set to the true", func() { BeforeEach(func() { space.AllowSSH = true spaceReq := new(requirementsfakes.FakeSpaceRequirement) spaceReq.GetSpaceReturns(space) requirementsFactory.NewSpaceRequirementReturns(spaceReq) }) It("notifies the user", func() { runCommand("the-space-name") Expect(ui.Outputs()).To(ContainSubstrings([]string{"ssh support is already enabled in space 'the-space-name'"})) }) }) Context("Updating allow_ssh when not already set to true", func() { Context("Update successfully", func() { BeforeEach(func() {
BeforeEach(func() { requirementsFactory.NewLoginRequirementReturns(requirements.Passing{}) requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement)) space = models.Space{} space.Name = "the-space-name" space.GUID = "the-space-guid" spaceReq := new(requirementsfakes.FakeSpaceRequirement) spaceReq.GetSpaceReturns(space) requirementsFactory.NewSpaceRequirementReturns(spaceReq) }) Context("when SSH is enabled for the space", func() { It("notifies the user", func() { space.AllowSSH = true spaceReq := new(requirementsfakes.FakeSpaceRequirement) spaceReq.GetSpaceReturns(space) requirementsFactory.NewSpaceRequirementReturns(spaceReq) runCommand("the-space-name") Expect(ui.Outputs()).To(ContainSubstrings([]string{"ssh support is enabled in space 'the-space-name'"})) }) }) Context("when SSH is disabled for the space", func() { It("notifies the user", func() { runCommand("the-space-name") Expect(ui.Outputs()).To(ContainSubstrings([]string{"ssh support is disabled in space 'the-space-name'"}))