Example #1
0
			})

			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"))