Expect(ui.Outputs()).To(ContainSubstrings( []string{"FAILED"}, []string{"Error"}, )) Expect(spaceRepo.CreateCallCount()).To(BeZero()) }) }) Context("when the -q flag is provided", func() { It("assigns the space-quota specified to the space", func() { spaceQuota := models.SpaceQuota{ Name: "my-space-quota", GUID: "my-space-quota-guid", } spaceQuotaRepo.FindByNameAndOrgGUIDReturns(spaceQuota, nil) runCommand("-q", "my-space-quota", "my-space") spaceQuotaName, orgGUID := spaceQuotaRepo.FindByNameAndOrgGUIDArgsForCall(0) Expect(spaceQuotaName).To(Equal(spaceQuota.Name)) Expect(orgGUID).To(Equal(configOrg.GUID)) _, _, actualSpaceQuotaGUID := spaceRepo.CreateArgsForCall(0) Expect(actualSpaceQuotaGUID).To(Equal(spaceQuota.GUID)) }) Context("when the space-quota provided does not exist", func() { It("fails", func() { spaceQuotaRepo.FindByNameAndOrgGUIDReturns(models.SpaceQuota{}, errors.New("Error")) runCommand("-q", "my-space-quota", "my-space")