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

			testassert.SliceContains(ui.Outputs, testassert.Lines{
				{"Deleting user", "user-name"},
				{"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")

			testassert.SliceContains(ui.Outputs, testassert.Lines{
				{"Deleting user", "user-name"},
				{"OK"},
			})

			testassert.SliceContains(ui.WarnOutputs, testassert.Lines{
				{"user-name", "does not exist"},
			})

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