Пример #1
0
			var err error

			Context("when no flags are provided", func() {
				BeforeEach(func() {
					flagContext.Parse("myquota")
					actualRequirements, err = cmd.Requirements(reqFactory, flagContext)
					Expect(err).NotTo(HaveOccurred())
				})

				It("returns a login requirement", func() {
					Expect(reqFactory.NewLoginRequirementCallCount()).To(Equal(1))
					Expect(actualRequirements).To(ContainElement(loginReq))
				})

				It("returns a targeted org requirement", func() {
					Expect(reqFactory.NewTargetedOrgRequirementCallCount()).To(Equal(1))
					Expect(actualRequirements).To(ContainElement(targetedOrgReq))
				})

				It("does not return a min api requirement", func() {
					Expect(reqFactory.NewMinAPIVersionRequirementCallCount()).To(Equal(0))
				})
			})

			Context("when the -a flag is provided", func() {
				BeforeEach(func() {
					flagContext.Parse("myquota", "-a", "2")
					actualRequirements, err = cmd.Requirements(reqFactory, flagContext)
					Expect(err).NotTo(HaveOccurred())
				})