Expect(ui.Prompts).To(ContainSubstrings([]string{"Really purge service offering service-name from Cloud Foundry?"})) }) Context("when the user confirms", func() { BeforeEach(func() { ui.Inputs = []string{"y"} }) It("tells the user it will purge the service offering", func() { cmd.Execute(flagContext) Expect(ui.Outputs).To(ContainSubstrings([]string{"Purging service service-name..."})) }) It("tries to purge the service offering", func() { cmd.Execute(flagContext) Expect(serviceRepo.PurgeServiceOfferingCallCount()).To(Equal(1)) }) Context("when purging succeeds", func() { BeforeEach(func() { serviceRepo.PurgeServiceOfferingReturns(nil) }) It("says OK", func() { cmd.Execute(flagContext) Expect(ui.Outputs).To(ContainSubstrings([]string{"OK"})) }) }) Context("when purging fails", func() { BeforeEach(func() {