示例#1
0
				Ω(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() {
					space.AllowSSH = false
					requirementsFactory.Space = space
				})

				It("updates the space's allow_ssh", func() {
					runCommand("the-space-name")

					Ω(spaceRepo.SetAllowSSHCallCount()).To(Equal(1))
					spaceGUID, allow := spaceRepo.SetAllowSSHArgsForCall(0)
					Ω(spaceGUID).To(Equal("the-space-guid"))
					Ω(allow).To(Equal(true))
					Ω(ui.Outputs).To(ContainSubstrings([]string{"Enabling ssh support for space 'the-space-name'"}))
					Ω(ui.Outputs).To(ContainSubstrings([]string{"OK"}))
				})
			})

			Context("Update fails", func() {
				It("notifies user of any api error", func() {
					spaceRepo.SetAllowSSHReturns(errors.New("api error"))
					runCommand("the-space-name")

					Ω(ui.Outputs).To(ContainSubstrings(
						[]string{"FAILED"},
						[]string{"Error", "api error"},