Example #1
0
		})

		Context("when it finds the domain successfully", func() {
			var actualDomain models.DomainFields

			BeforeEach(func() {
				actualDomain = models.DomainFields{
					GUID: "domain-guid",
					Name: "domain-name",
				}
				domainRepo.FindByNameInOrgReturns(actualDomain, nil)
			})

			It("checks if the route exists", func() {
				Expect(err).NotTo(HaveOccurred())
				Expect(routeRepo.CheckIfExistsCallCount()).To(Equal(1))
				hostName, domain, path := routeRepo.CheckIfExistsArgsForCall(0)
				Expect(hostName).To(Equal("host-name"))
				Expect(actualDomain).To(Equal(domain))
				Expect(path).To(Equal(""))
			})

			Context("when a path is passed", func() {
				BeforeEach(func() {
					flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
					err := flagContext.Parse("hostname", "domain-name", "--path", "the-path")
					Expect(err).NotTo(HaveOccurred())
					cmd.Requirements(factory, flagContext)
				})

				It("checks if the route exists", func() {