It("returns plans fully populated with the orgnames that have visibility", func() { barePlans := []models.ServicePlanFields{plan1, plan2} plans, err := builder.AttachOrgsToPlans(barePlans) Expect(err).ToNot(HaveOccurred()) Expect(plans[0].OrgNames).To(Equal([]string{"org1", "org2"})) }) }) Describe(".AttachOrgToPlans", func() { It("returns plans fully populated with the orgnames that have visibility", func() { orgRepo.FindByNameReturns(org1, nil) barePlans := []models.ServicePlanFields{plan1, plan2} plans, err := builder.AttachOrgToPlans(barePlans, "org1") Expect(err).ToNot(HaveOccurred()) Expect(plans[0].OrgNames).To(Equal([]string{"org1"})) }) }) Describe(".GetPlansForServiceWithOrgs", func() { It("returns all the plans for the service with the provided guid", func() { plans, err := builder.GetPlansForServiceWithOrgs("service-guid1") Expect(err).ToNot(HaveOccurred()) Expect(len(plans)).To(Equal(2)) Expect(plans[0].Name).To(Equal("service-plan1")) Expect(plans[0].OrgNames).To(Equal([]string{"org1", "org2"})) Expect(plans[1].Name).To(Equal("service-plan2"))