Esempio n. 1
0
			[]string{"Creating space", "my-space", "my-org", "my-user"},
			[]string{"OK"},
			[]string{"Assigning", models.SpaceRoleToUserInput[models.SPACE_MANAGER], "my-user", "my-space"},
			[]string{"Assigning", models.SpaceRoleToUserInput[models.SPACE_DEVELOPER], "my-user", "my-space"},
			[]string{"TIP"},
		))

		Expect(spaceRepo.CreateSpaceName).To(Equal("my-space"))
		Expect(spaceRepo.CreateSpaceOrgGuid).To(Equal("my-org-guid"))
		Expect(userRepo.SetSpaceRoleUserGuid).To(Equal("my-user-guid"))
		Expect(userRepo.SetSpaceRoleSpaceGuid).To(Equal("my-space-guid"))
		Expect(userRepo.SetSpaceRoleRole).To(Equal(models.SPACE_DEVELOPER))
	})

	It("warns the user when a space with that name already exists", func() {
		spaceRepo.CreateSpaceExists = true
		runCommand("my-space")

		Expect(ui.Outputs).To(ContainSubstrings(
			[]string{"Creating space", "my-space"},
			[]string{"OK"},
		))
		Expect(ui.WarnOutputs).To(ContainSubstrings([]string{"my-space", "already exists"}))
		Expect(ui.Outputs).ToNot(ContainSubstrings(
			[]string{"Assigning", "my-user", "my-space", models.SpaceRoleToUserInput[models.SPACE_MANAGER]},
		))

		Expect(spaceRepo.CreateSpaceName).To(Equal(""))
		Expect(spaceRepo.CreateSpaceOrgGuid).To(Equal(""))
		Expect(userRepo.SetSpaceRoleUserGuid).To(Equal(""))
		Expect(userRepo.SetSpaceRoleSpaceGuid).To(Equal(""))