コード例 #1
0
	})

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

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

		Expect(len(ui.Prompts)).To(Equal(0))
		Expect(serviceRepo.PurgeServiceOfferingCalled).To(Equal(true))
	})

	It("fails with an error message when the request fails", func() {
		serviceRepo.FindServiceOfferingByLabelAndProviderApiResponse = cferrors.NewWithError("oh no!", errors.New("!"))

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

		Expect(ui.Outputs).To(ContainSubstrings(
			[]string{"FAILED"},
			[]string{"oh no!"},
		))

		Expect(serviceRepo.PurgeServiceOfferingCalled).To(Equal(false))
	})

	It("fails with an error message when the purging request fails", func() {
		serviceRepo.PurgeServiceOfferingApiResponse = cferrors.New("crumpets insufficiently buttered")
コード例 #2
0
	})

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

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

		Expect(len(ui.Prompts)).To(Equal(0))
		Expect(serviceRepo.PurgeServiceOfferingCalled).To(Equal(true))
	})

	It("fails with an error message when the request fails", func() {
		serviceRepo.FindServiceOfferingByLabelAndProviderApiResponse = fmt.Errorf("%s: %s", "oh no!", errors.New("!").Error())

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

		Expect(ui.Outputs).To(ContainSubstrings(
			[]string{"FAILED"},
			[]string{"oh no!"},
		))

		Expect(serviceRepo.PurgeServiceOfferingCalled).To(Equal(false))
	})

	It("fails with an error message when the purging request fails", func() {
		serviceRepo.PurgeServiceOfferingApiResponse = fmt.Errorf("crumpets insufficiently buttered")