Пример #1
0
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Incorrect Usage. Requires USERNAME, ORG, SPACE, ROLE as arguments"},
					[]string{"NAME"},
					[]string{"USAGE"},
				))
			})
		})

		Context("when provided three args", func() {
			BeforeEach(func() {
				flagContext.Parse("the-username", "the-org-name", "the-space-name", "SpaceManager")
			})

			It("returns a LoginRequirement", func() {
				requirementsFactory.LoginSuccess = false
				requirementsFactory.UserRequirementFails = false
				requirementsFactory.SpaceRequirementFails = false
				actualRequirements, err := cmd.Requirements(requirementsFactory, flagContext)
				Expect(err).NotTo(HaveOccurred())

				var failures int
				for _, req := range actualRequirements {
					ok := req.Execute()
					if !ok {
						failures = failures + 1
					}
				}

				Expect(failures).To(Equal(1))
			})