Exemplo n.º 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() {
				cmd.Execute(flagContext)
				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())
					_, err = cmd.Requirements(factory, flagContext)
					Expect(err).NotTo(HaveOccurred())
				})

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