}) }) Context("when the user is logged in", func() { BeforeEach(func() { requirementsFactory.LoginSuccess = true }) It("fails requirements when called without a quota name", func() { runCommand() Expect(ui.FailedWithUsage).To(BeTrue()) }) It("creates a quota with a given name", func() { runCommand("my-quota") Expect(quotaRepo.CreateArgsForCall(0).Name).To(Equal("my-quota")) Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating quota", "my-quota", "my-user", "..."}, []string{"OK"}, )) }) Context("when the -m flag is provided", func() { It("sets the memory limit", func() { runCommand("-m", "50G", "erryday makin fitty jeez") Expect(quotaRepo.CreateArgsForCall(0).MemoryLimit).To(Equal(int64(51200))) }) It("alerts the user when parsing the memory limit fails", func() { runCommand("whoops", "12")