It("fails requirements when called without a quota name", func() { runCommand() Expect(ui.FailedWithUsage).To(BeTrue()) }) It("fails requirements when an org is not targeted", func() { requirementsFactory.TargetedOrgSuccess = false Expect(runCommand()).To(BeFalse()) }) Context("When the quota provided exists", func() { BeforeEach(func() { quota := models.SpaceQuota{} quota.Name = "my-quota" quota.Guid = "my-quota-guid" quota.OrgGuid = "my-org-guid" quotaRepo.FindByNameReturns(quota, nil) }) It("deletes a quota with a given name when the user confirms", func() { ui.Inputs = []string{"y"} runCommand("my-quota") Expect(quotaRepo.DeleteArgsForCall(0)).To(Equal("my-quota-guid")) Expect(ui.Prompts).To(ContainSubstrings( []string{"Really delete the quota", "my-quota"}, )) Expect(ui.Outputs).To(ContainSubstrings( []string{"Deleting space quota", "my-quota", "as", "my-user"},