Ejemplo n.º 1
0
	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true
		})

		It("fails with usage when no service name is given", func() {
			runCommand()
			Expect(ui.FailedWithUsage).To(BeTrue())
		})

		Context("when the service exists", func() {
			BeforeEach(func() {
				serviceInstance = models.ServiceInstance{}
				serviceInstance.Name = "my-service"
				serviceInstance.Guid = "my-service-guid"
				serviceRepo.FindInstanceByNameServiceInstance = serviceInstance
			})

			Context("when the command is confirmed", func() {
				It("deletes the service", func() {
					runCommand("my-service")

					testassert.SliceContains(ui.Prompts, testassert.Lines{
						{"Really delete the service my-service"},
					})

					testassert.SliceContains(ui.Outputs, testassert.Lines{
						{"Deleting service", "my-service", "my-org", "my-space", "my-user"},
						{"OK"},
					})