Beispiel #1
0
					Expect(actualUsername).To(Equal("the-user-name"))
					Expect(actualSpaceGUID).To(Equal("the-space-guid"))
					Expect(actualRole).To(Equal("SpaceManager"))
				})

				It("tells the user it is removing the role", func() {
					cmd.Execute(flagContext)
					Expect(ui.Outputs).To(ContainSubstrings(
						[]string{"Removing role", "SpaceManager", "the-user-name", "the-org", "the-user-name"},
						[]string{"OK"},
					))
				})

				Context("when the call to CC fails", func() {
					BeforeEach(func() {
						userRepo.UnsetSpaceRoleByUsernameReturns(errors.New("user-repo-error"))
					})

					It("panics and prints a failure message", func() {
						Expect(func() { cmd.Execute(flagContext) }).To(Panic())
						Expect(ui.Outputs).To(BeInDisplayOrder(
							[]string{"FAILED"},
							[]string{"user-repo-error"},
						))
					})
				})
			})
		})
	})
})