Пример #1
0
			})
		})
	})

	Describe("Execute", func() {
		BeforeEach(func() {
			err := flagContext.Parse("space-name", "domain-name", "-n", "hostname", "--path", "path")
			Expect(err).NotTo(HaveOccurred())
			_, err = cmd.Requirements(factory, flagContext)
			Expect(err).NotTo(HaveOccurred())
		})

		It("attempts to create a route in the space", func() {
			cmd.Execute(flagContext)

			Expect(routeRepo.CreateInSpaceCallCount()).To(Equal(1))
			hostname, path, domain, space := routeRepo.CreateInSpaceArgsForCall(0)
			Expect(hostname).To(Equal("hostname"))
			Expect(path).To(Equal("/path"))
			Expect(domain).To(Equal("domain-guid"))
			Expect(space).To(Equal("space-guid"))
		})

		It("does not add an extra forward slash when the path contains a prefixed forward slash", func() {
			cmd.Execute(flagContext)

			Expect(routeRepo.CreateInSpaceCallCount()).To(Equal(1))
			_, path, _, _ := routeRepo.CreateInSpaceArgsForCall(0)
			Expect(path).To(Equal("/path"))
		})