Пример #1
0
			})
		})
	})

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

		It("finds the instance by name in the service repo", func() {
			err := flagContext.Parse("service-instance-name", "-f")
			Expect(err).NotTo(HaveOccurred())
			cmd.Execute(flagContext)
			Expect(serviceRepo.FindInstanceByNameCallCount()).To(Equal(1))
		})

		Context("when the instance can be found", func() {
			var serviceInstance models.ServiceInstance

			BeforeEach(func() {
				serviceInstance = models.ServiceInstance{}
				serviceInstance.Name = "service-instance-name"
				serviceRepo.FindInstanceByNameReturns(serviceInstance, nil)
			})

			It("warns the user", func() {
				ui.Inputs = []string{"n"}
				cmd.Execute(flagContext)
				Eventually(func() []string {