It("fails when called without exactly one arg", func() { requirementsFactory.LoginSuccess = true passed := runCommand([]string{}) Expect(passed).To(BeFalse()) Expect(ui.Outputs).To(ContainSubstrings( []string{"Incorrect Usage", "Requires", "argument"}, )) }) }) It("works when given -p and a provider name", func() { offering := maker.NewServiceOffering("the-service-name") serviceRepo.FindServiceOfferingByLabelAndProviderServiceOffering = offering ui.Inputs = []string{"yes"} runCommand([]string{"-p", "the-provider", "the-service-name"}) Expect(serviceRepo.FindServiceOfferingByLabelAndProviderName).To(Equal("the-service-name")) Expect(serviceRepo.FindServiceOfferingByLabelAndProviderProvider).To(Equal("the-provider")) Expect(serviceRepo.PurgedServiceOffering).To(Equal(offering)) }) It("works when not given a provider", func() { offering := maker.NewServiceOffering("the-service-name") serviceRepo.FindServiceOfferingByLabelAndProviderServiceOffering = offering ui.Inputs = []string{"yes"}