Example #1
0
	Describe("disallow-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"
		})

		Context("when allow_ssh is already set to the false", func() {
			BeforeEach(func() {
				space.AllowSSH = false
				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 disabled in space 'the-space-name'"}))
			})
		})

		Context("Updating allow_ssh when not already set to false", func() {
			Context("Update successfully", func() {
				BeforeEach(func() {
Example #2
0
		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'"}))