Exemple #1
0
		})
	})
	Context("when the domain exists", func() {
		BeforeEach(func() {
			domainRepo.FindByNameInOrgReturns(
				models.DomainFields{
					Name: "foo.com",
					GUID: "foo-guid",
				}, nil)
		})

		It("deletes domains", func() {
			runCommand("foo.com")

			Expect(domainRepo.DeleteArgsForCall(0)).To(Equal("foo-guid"))

			Expect(ui.Prompts).To(ContainSubstrings([]string{"Really delete the domain foo.com"}))
			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Deleting domain", "foo.com", "my-user"},
				[]string{"OK"},
			))
		})

		Context("when there is an error deleting the domain", func() {
			BeforeEach(func() {
				domainRepo.DeleteReturns(errors.New("failed badly"))
			})

			It("show the error the user", func() {
				runCommand("foo.com")