コード例 #1
0
ファイル: target_test.go プロジェクト: janfalee/cli
		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"},
			))
		})
	})
})