Exemplo n.º 1
0
			It("it updates the organization in the config", func() {
				callTarget([]string{"-o", "my-organization"})

				Expect(orgRepo.FindByNameArgsForCall(0)).To(Equal("my-organization"))
				Expect(ui.ShowConfigurationCalled).To(BeTrue())

				Expect(config.OrganizationFields().Guid).To(Equal("my-organization-guid"))
			})

			It("updates the space in the config", func() {
				space := models.Space{}
				space.Name = "my-space"
				space.Guid = "my-space-guid"

				spaceRepo.Spaces = []models.Space{space}
				spaceRepo.FindByNameSpace = space

				callTarget([]string{"-s", "my-space"})

				Expect(spaceRepo.FindByNameName).To(Equal("my-space"))
				Expect(config.SpaceFields().Guid).To(Equal("my-space-guid"))
				Expect(ui.ShowConfigurationCalled).To(BeTrue())
			})

			It("updates both the organization and the space in the config", func() {
				space := models.Space{}
				space.Name = "my-space"
				space.Guid = "my-space-guid"
				spaceRepo.Spaces = []models.Space{space}

				callTarget([]string{"-o", "my-organization", "-s", "my-space"})