Ejemplo n.º 1
0
		Expect(ui.Outputs).To(ContainSubstrings([]string{"Purging service the-service-name..."}))

		name, provider := serviceRepo.FindServiceOfferingByLabelAndProviderArgsForCall(0)
		Expect(name).To(Equal("the-service-name"))
		Expect(provider).To(BeEmpty())
		Expect(serviceRepo.PurgeServiceOfferingArgsForCall(0)).To(Equal(offering))

		Expect(ui.Outputs).To(ContainSubstrings([]string{"OK"}))
	})

	It("exits when the user does not acknowledge the confirmation", func() {
		ui.Inputs = []string{"no"}

		runCommand([]string{"the-service-name"})

		Expect(serviceRepo.FindServiceOfferingByLabelAndProviderCallCount()).To(Equal(1))
		Expect(serviceRepo.PurgeServiceOfferingCallCount()).To(BeZero())
	})

	It("does not prompt with confirmation when -f is passed", func() {
		offering := maker.NewServiceOffering("the-service-name")
		serviceRepo.FindServiceOfferingByLabelAndProviderReturns(offering, nil)

		runCommand(
			[]string{"-f", "the-service-name"},
		)

		Expect(len(ui.Prompts)).To(Equal(0))
		Expect(serviceRepo.PurgeServiceOfferingCallCount()).To(Equal(1))
	})