示例#1
0
			RepoLocator: repoLocator,
		}

		cmd = &user.UnsetOrgRole{}
		cmd.SetDependency(deps, false)

		flagContext = flags.NewFlagContext(map[string]flags.FlagSet{})

		factory = &fakerequirements.FakeFactory{}

		loginRequirement = &passingRequirement{}
		factory.NewLoginRequirementReturns(loginRequirement)

		userRequirement = &fakerequirements.FakeUserRequirement{}
		userRequirement.ExecuteReturns(true)
		factory.NewUserRequirementReturns(userRequirement)

		organizationRequirement = &fakerequirements.FakeOrganizationRequirement{}
		organizationRequirement.ExecuteReturns(true)
		factory.NewOrganizationRequirementReturns(organizationRequirement)
	})

	Describe("Requirements", func() {
		Context("when not provided exactly three args", func() {
			BeforeEach(func() {
				flagContext.Parse("the-user-name", "the-org-name")
			})

			It("fails with usage", func() {
				Expect(func() { cmd.Requirements(factory, flagContext) }).To(Panic())
				Expect(ui.Outputs).To(ContainSubstrings(