예제 #1
0
				Expect(actualRequirements).To(ContainElement(targetedOrgRequirement))
			})
		})
	})

	Describe("Execute", func() {
		It("prints getting domains message", func() {
			cmd.Execute(flagContext)
			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Getting domains in org my-org"},
			))
		})

		It("tries to get the list of domains for org", func() {
			cmd.Execute(flagContext)
			Expect(domainRepo.ListDomainsForOrgCallCount()).To(Equal(1))
			orgGuid, _ := domainRepo.ListDomainsForOrgArgsForCall(0)
			Expect(orgGuid).To(Equal("my-org-guid"))
		})

		It("prints no domains found message", func() {
			cmd.Execute(flagContext)
			Expect(ui.Outputs).To(BeInDisplayOrder(
				[]string{"name", "status", "type"},
				[]string{"No domains found"},
			))
		})

		Context("when list domains for org returns error", func() {
			BeforeEach(func() {
				domainRepo.ListDomainsForOrgReturns(errors.New("org-domain-err"))