Example #1
0
			space.ServiceInstances = services
			space.SecurityGroups = securityGroups
			space.SpaceQuotaGuid = "runaway-guid"

			quota := models.SpaceQuota{}
			quota.Guid = "runaway-guid"
			quota.Name = "runaway"
			quota.MemoryLimit = 102400
			quota.InstanceMemoryLimit = -1
			quota.RoutesLimit = 111
			quota.ServicesLimit = 222
			quota.NonBasicServicesAllowed = false

			requirementsFactory.LoginSuccess = true
			requirementsFactory.TargetedOrgSuccess = true
			requirementsFactory.Space = space

			quotaRepo.FindByGuidReturns(quota, nil)
		})

		Context("when the space has a space quota", func() {
			It("shows information about the given space", func() {
				runCommand("whose-space-is-it-anyway")
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Getting info for space", "whose-space-is-it-anyway", "my-org", "my-user"},
					[]string{"OK"},
					[]string{"whose-space-is-it-anyway"},
					[]string{"Org", "my-org"},
					[]string{"Apps", "app1"},
					[]string{"Domains", "domain1"},
					[]string{"Services", "service1"},
Example #2
0
			runCommand("my-space")
			Expect(ui.FailedWithUsage).To(BeTrue())
		})
	})

	Context("when logged in, targeted a space and given a domain that exists", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true
			requirementsFactory.TargetedOrgSuccess = true
			requirementsFactory.Domain = models.DomainFields{
				Guid: "domain-guid",
				Name: "example.com",
			}
			requirementsFactory.Space = models.Space{SpaceFields: models.SpaceFields{
				Guid: "my-space-guid",
				Name: "my-space",
			}}
		})

		It("creates routes, obviously", func() {
			runCommand("-n", "host", "my-space", "example.com")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Creating route", "host.example.com", "my-org", "my-space", "my-user"},
				[]string{"OK"},
			))

			Expect(routeRepo.CreateInSpaceHost).To(Equal("host"))
			Expect(routeRepo.CreateInSpaceDomainGuid).To(Equal("domain-guid"))
			Expect(routeRepo.CreateInSpaceSpaceGuid).To(Equal("my-space-guid"))
		})