Expect(servicePlan.Public).To(BeTrue()) Expect(serviceGUID).To(Equal("my-mixed-service-guid")) Expect(public).To(BeFalse()) }) }) }) Describe(".UpdatePlanAndOrgForService", func() { BeforeEach(func() { orgRepo.FindByNameReturns(org1, nil) }) It("returns an error if the service cannot be found", func() { serviceBuilder.GetServiceByNameWithPlansReturns(models.ServiceOffering{}, errors.New("service was not found")) err := actor.UpdatePlanAndOrgForService("not-a-service", "public-service-plan", "public-org", true) Expect(err.Error()).To(Equal("service was not found")) }) It("returns an error if the org cannot be found", func() { orgRepo.FindByNameReturns(models.Organization{}, errors.NewModelNotFoundError("organization", "not-an-org")) err := actor.UpdatePlanAndOrgForService("a-real-service", "public-service-plan", "not-an-org", true) Expect(err).To(HaveOccurred()) }) It("returns an error if the plan cannot be found", func() { serviceBuilder.GetServiceByNameWithPlansReturns(mixedService, nil) err := actor.UpdatePlanAndOrgForService("a-real-service", "not-a-plan", "org-1", true) Expect(err).To(HaveOccurred()) })