}) }) Describe("when the user provides fewer than two args", func() { It("fails with usage", func() { callRenameSpace([]string{"foo"}) Expect(ui.FailedWithUsage).To(BeTrue()) }) }) Describe("when the user is logged in and has provided an old and new space name", func() { BeforeEach(func() { space := models.Space{} space.Name = "the-old-space-name" space.Guid = "the-old-space-guid" reqFactory.Space = space }) It("renames a space", func() { originalSpaceName := configRepo.SpaceFields().Name callRenameSpace([]string{"the-old-space-name", "my-new-space"}) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Renaming space", "the-old-space-name", "my-new-space", "my-org", "my-user"}, {"OK"}, }) Expect(spaceRepo.RenameSpaceGuid).To(Equal("the-old-space-guid")) Expect(spaceRepo.RenameNewName).To(Equal("my-new-space")) Expect(configRepo.SpaceFields().Name).To(Equal(originalSpaceName)) })
}) }) Describe("when the user provides fewer than two args", func() { It("fails with usage", func() { callRenameSpace([]string{"foo"}) Expect(ui.FailedWithUsage).To(BeTrue()) }) }) Describe("when the user is logged in and has provided an old and new space name", func() { BeforeEach(func() { space := models.Space{} space.Name = "the-old-space-name" space.Guid = "the-old-space-guid" requirementsFactory.Space = space }) It("renames a space", func() { originalSpaceName := configRepo.SpaceFields().Name callRenameSpace([]string{"the-old-space-name", "my-new-space"}) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Renaming space", "the-old-space-name", "my-new-space", "my-org", "my-user"}, {"OK"}, }) Expect(spaceRepo.RenameSpaceGuid).To(Equal("the-old-space-guid")) Expect(spaceRepo.RenameNewName).To(Equal("my-new-space")) Expect(configRepo.SpaceFields().Name).To(Equal(originalSpaceName)) })