var expectedDomain ccv2.Domain BeforeEach(func() { expectedDomain = ccv2.Domain{ GUID: "shared-domain-guid", Name: "shared-domain", } fakeCloudControllerClient.GetSharedDomainReturns(expectedDomain, nil, nil) }) It("returns the shared domain", func() { domain, _, err := actor.GetDomain("shared-domain-guid") Expect(err).NotTo(HaveOccurred()) Expect(domain).To(Equal(Domain(expectedDomain))) Expect(fakeCloudControllerClient.GetSharedDomainCallCount()).To(Equal(1)) Expect(fakeCloudControllerClient.GetSharedDomainArgsForCall(0)).To(Equal("shared-domain-guid")) }) }) Context("when the domain exists and is a private domain", func() { var expectedDomain ccv2.Domain BeforeEach(func() { expectedDomain = ccv2.Domain{ GUID: "private-domain-guid", Name: "private-domain", } fakeCloudControllerClient.GetSharedDomainReturns(ccv2.Domain{}, nil, ccv2.ResourceNotFoundError{}) fakeCloudControllerClient.GetPrivateDomainReturns(expectedDomain, nil, nil) })