예제 #1
0
		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"))
		})

		It("is idempotent", func() {
			routeRepo.CreateInSpaceErr = true
			routeRepo.FindByHostAndDomainReturns.Route = models.Route{
				Space:  requirementsFactory.Space.SpaceFields,
				Guid:   "my-route-guid",
				Host:   "host",
				Domain: requirementsFactory.Domain,
			}

			runCommand("-n", "host", "my-space", "example.com")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Creating route"},
				[]string{"OK"},
				[]string{"host.example.com", "already exists"},
			))