Exemplo n.º 1
0
		It("fails when the user doesn't have access to the space", func() {
			spaceRepo.FindByNameErr = true

			callTarget([]string{"-s", "my-space"})

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"FAILED"},
				[]string{"Unable to access space", "my-space"},
			))

			Expect(config.SpaceFields().Guid).To(Equal(""))
			Expect(ui.ShowConfigurationCalled).To(BeFalse())

			Expect(config.OrganizationFields().Guid).NotTo(BeEmpty())
			expectSpaceToBeCleared()
		})

		It("fails when the space is not found", func() {
			spaceRepo.FindByNameNotFound = true

			callTarget([]string{"-s", "my-space"})

			expectSpaceToBeCleared()
			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"FAILED"},
				[]string{"my-space", "not found"},
			))
		})
	})
})