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") Expect(ui.Prompts).To(ContainSubstrings([]string{"Really delete the service my-service"})) Expect(ui.Outputs).To(ContainSubstrings( []string{"Deleting service", "my-service", "my-org", "my-space", "my-user"}, []string{"OK"}, )) Expect(serviceRepo.DeleteServiceServiceInstance).To(Equal(serviceInstance)) })