}) }) Context("when logged in and a space is targeted", func() { var serviceInstance models.ServiceInstance BeforeEach(func() { serviceInstance = models.ServiceInstance{} serviceInstance.Name = "different-name" serviceInstance.GUID = "different-name-guid" requirementsFactory.LoginSuccess = true requirementsFactory.TargetedSpaceSuccess = true requirementsFactory.ServiceInstance = serviceInstance }) It("renames the service, obviously", func() { runCommand("my-service", "new-name") Expect(ui.Outputs).To(ContainSubstrings( []string{"Renaming service", "different-name", "new-name", "my-org", "my-space", "my-user"}, []string{"OK"}, )) actualServiceInstance, actualServiceName := serviceRepo.RenameServiceArgsForCall(0) Expect(actualServiceInstance).To(Equal(serviceInstance)) Expect(actualServiceName).To(Equal("new-name")) }) }) })