Beispiel #1
0
					Expect(findDomainErr).NotTo(HaveOccurred())
					Expect(fakeDomainRepository.FindPrivateByNameCallCount()).To(Equal(2))
					Expect(fakeDomainRepository.FindSharedByNameCallCount()).To(Equal(2))
					Expect(fakeDomainRepository.FindSharedByNameArgsForCall(0)).To(Equal("my-hostname.my-domain.com"))
					Expect(fakeDomainRepository.FindSharedByNameArgsForCall(1)).To(Equal("my-domain.com"))
					Expect(hostname).To(Equal("my-hostname"))
					Expect(domain).To(Equal(sharedDomain))
				})
			})
		})

		Context("when the route does not belong to any existing domains", func() {
			BeforeEach(func() {
				routeName = "non-existant-domain.com"
				fakeDomainRepository.FindPrivateByNameReturns(models.DomainFields{}, domainNotFoundError)
				fakeDomainRepository.FindSharedByNameReturns(models.DomainFields{}, domainNotFoundError)
			})

			It("returns an error", func() {
				Expect(findDomainErr).To(HaveOccurred())
				Expect(findDomainErr.Error()).To(Equal("The route non-existant-domain.com did not match any existing domains."))
			})
		})
	})

	Describe("FindPath", func() {
		Context("when there is a path", func() {
			It("returns the route without path and the path", func() {
				routeName := "host.domain/long/path"
				route, path := routeActor.FindPath(routeName)
				Expect(route).To(Equal("host.domain"))