Пример #1
0
					ui.Inputs = []string{"y"}
				})

				It("tells the user it will purge the service offering", func() {
					Expect(runCLIErr).NotTo(HaveOccurred())
					Expect(ui.Outputs()).To(ContainSubstrings([]string{"Purging service service-name..."}))
				})

				It("tries to purge the service offering", func() {
					Expect(runCLIErr).NotTo(HaveOccurred())
					Expect(serviceRepo.PurgeServiceOfferingCallCount()).To(Equal(1))
				})

				Context("when purging succeeds", func() {
					BeforeEach(func() {
						serviceRepo.PurgeServiceOfferingReturns(nil)
					})

					It("says OK", func() {
						Expect(runCLIErr).NotTo(HaveOccurred())
						Expect(ui.Outputs()).To(ContainSubstrings([]string{"OK"}))
					})
				})

				Context("when purging fails", func() {
					BeforeEach(func() {
						serviceRepo.PurgeServiceOfferingReturns(errors.New("purge-err"))
					})

					It("fails with error", func() {
						Expect(runCLIErr).To(HaveOccurred())