Beispiel #1
0
	})

	Context("when there are routes", func() {
		BeforeEach(func() {
			routeRepo.ListRoutesStub = func(cb func(models.Route) bool) error {
				app1 := models.ApplicationFields{Name: "dora"}

				route := models.Route{}
				route.Host = "hostname-1"
				route.Domain = models.DomainFields{Name: "example.com"}
				route.Apps = []models.ApplicationFields{app1}

				cb(route)

				domain2 := models.DomainFields{Name: "cookieclicker.co"}
				app2 := models.ApplicationFields{Name: "bora"}

				route2 := models.Route{}
				route2.Host = "hostname-2"
				route2.Path = "/foo"
				route2.Domain = domain2
				route2.Apps = []models.ApplicationFields{app1, app2}

				cb(route2)

				return nil
			}
		})

		It("lists routes", func() {
			runCommand()
		It("passes when confirmation is provided", func() {
			var ui *testterm.FakeUI
			domain := models.DomainFields{Name: "example.com"}
			domain2 := models.DomainFields{Name: "cookieclicker.co"}

			app1 := models.ApplicationFields{Name: "dora"}

			routeRepo.ListRoutesStub = func(cb func(models.Route) bool) error {
				route := models.Route{}
				route.Guid = "route1-guid"
				route.Host = "hostname-1"
				route.Domain = domain
				route.Apps = []models.ApplicationFields{app1}

				route2 := models.Route{}
				route2.Guid = "route2-guid"
				route2.Host = "hostname-2"
				route2.Domain = domain2

				cb(route)
				cb(route2)

				return nil
			}

			ui, _ = callDeleteOrphanedRoutes("y", []string{}, reqFactory, routeRepo)

			Expect(ui.Prompts).To(ContainSubstrings(
				[]string{"Really delete orphaned routes"},
			))