}) Context("when the space quota was previously assigned to a space", func() { BeforeEach(func() { spaceRepo.FindByNameReturns( models.Space{ SpaceFields: models.SpaceFields{ Name: "my-space", GUID: "my-space-guid", }, SpaceQuotaGUID: "another-quota", }, nil) }) It("warns the user that the operation was not performed", func() { Expect(quotaRepo.UpdateCallCount()).To(Equal(0)) Expect(ui.Outputs()).To(ContainSubstrings( []string{"Assigning space quota", "to space", "my-user"}, )) Expect(executeErr).To(HaveOccurred()) Expect(executeErr.Error()).To(Equal("This space already has an assigned space quota.")) }) }) }) Context("when an error occurs fetching the space", func() { var spaceError error BeforeEach(func() { spaceError = errors.New("space-repo-err") spaceRepo.FindByNameReturns(models.Space{}, spaceError)