}) It("fails when the api returns an error", func() { domainRepo.FindByNameInOrgApiResponse = errors.New("couldn't find the droids you're lookin for") runCommand("foo.com") Expect(ui.Outputs).To(ContainSubstrings( []string{"Deleting domain", "foo.com"}, []string{"FAILED"}, []string{"foo.com"}, []string{"couldn't find the droids you're lookin for"}, )) }) It("fails when deleting the domain encounters an error", func() { domainRepo.DeleteSharedApiResponse = errors.New("failed badly") runCommand("foo.com") Expect(domainRepo.DeleteSharedDomainGuid).To(Equal("foo-guid")) Expect(ui.Outputs).To(ContainSubstrings( []string{"Deleting domain", "foo.com"}, []string{"FAILED"}, []string{"foo.com"}, []string{"failed badly"}, )) }) It("Prompts a user to delete the shared domain", func() { runCommand("foo.com") Expect(domainRepo.DeleteSharedDomainGuid).To(Equal("foo-guid"))