Ejemplo n.º 1
0
			ui.Inputs = []string{}
			runCommand("-f", "user-name")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Deleting user", "user-name"},
				[]string{"OK"},
			))

			Expect(userRepo.FindByUsernameUsername).To(Equal("user-name"))
			Expect(userRepo.DeleteUserGuid).To(Equal("user-guid"))
		})
	})

	Context("when the given user does not exist", func() {
		BeforeEach(func() {
			userRepo.FindByUsernameNotFound = true
		})

		It("prints a warning", func() {
			runCommand("-f", "user-name")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Deleting user", "user-name"},
				[]string{"OK"},
			))

			Expect(ui.WarnOutputs).To(ContainSubstrings([]string{"user-name", "does not exist"}))

			Expect(userRepo.FindByUsernameUsername).To(Equal("user-name"))
			Expect(userRepo.DeleteUserGuid).To(Equal(""))
		})