Expect(factory.NewLoginRequirementCallCount()).To(Equal(1)) Expect(actualRequirements).To(ContainElement(loginRequirement)) }) It("returns a TargetedOrgRequirement", func() { actualRequirements, err := cmd.Requirements(factory, flagContext) Expect(err).NotTo(HaveOccurred()) Expect(factory.NewTargetedOrgRequirementCallCount()).To(Equal(1)) 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(
Expect(actualRequirements).To(ContainElement(loginRequirement)) }) It("returns a TargetedOrgRequirement", func() { actualRequirements := cmd.Requirements(factory, flagContext) Expect(factory.NewTargetedOrgRequirementCallCount()).To(Equal(1)) Expect(actualRequirements).To(ContainElement(targetedOrgRequirement)) }) }) }) Describe("Execute", func() { var err error JustBeforeEach(func() { err = cmd.Execute(flagContext) }) It("prints getting domains message", func() { Expect(err).NotTo(HaveOccurred()) Expect(ui.Outputs()).To(ContainSubstrings( []string{"Getting domains in org my-org"}, )) }) It("tries to get the list of domains for org", func() { Expect(err).NotTo(HaveOccurred()) Expect(domainRepo.ListDomainsForOrgCallCount()).To(Equal(1)) orgGUID, _ := domainRepo.ListDomainsForOrgArgsForCall(0) Expect(orgGUID).To(Equal("my-org-guid")) })