Exemplo n.º 1
0
				})
			})
		})
	})

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

		It("tries to find the route", func() {
			cmd.Execute(flagContext)
			Expect(routeRepo.FindCallCount()).To(Equal(1))
			hostname, domain, path := routeRepo.FindArgsForCall(0)
			Expect(hostname).To(Equal(""))
			Expect(domain).To(Equal(fakeDomain))
			Expect(path).To(Equal(""))
		})

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

			It("tries to find the route with the path", func() {
Exemplo n.º 2
0
		It("asks the user if they would like to proceed", func() {
			ui.Inputs = []string{"n"}
			cmd.Execute(flagContext)
			Eventually(func() []string { return ui.Prompts }).Should(ContainSubstrings(
				[]string{"Really delete the route"},
			))
		})

		Context("when the response is to proceed", func() {
			BeforeEach(func() {
				ui.Inputs = []string{"y"}
			})

			It("tries to find the route", func() {
				cmd.Execute(flagContext)
				Eventually(routeRepo.FindCallCount()).Should(Equal(1))
				host, domain, path := routeRepo.FindArgsForCall(0)
				Expect(host).To(Equal(""))
				Expect(path).To(Equal(""))
				Expect(domain).To(Equal(fakeDomain))
			})

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

				It("tries to find the route with the path", func() {