Пример #1
0
		cmd = new(routergroups.RouterGroups)
		cmd = cmd.SetDependency(deps, false).(*routergroups.RouterGroups)
		flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
	})

	Describe("Requirements", func() {
		It("fails if the user is not logged in", func() {
			cmd.Requirements(requirementsFactory, flagContext)

			Expect(requirementsFactory.NewLoginRequirementCallCount()).To(Equal(1))
		})

		It("fails when the routing API endpoint is not set", func() {
			cmd.Requirements(requirementsFactory, flagContext)

			Expect(requirementsFactory.NewRoutingAPIRequirementCallCount()).To(Equal(1))
		})

		It("should fail with usage", func() {
			flagContext.Parse("blahblah")
			cmd.Requirements(requirementsFactory, flagContext)

			Expect(requirementsFactory.NewUsageRequirementCallCount()).To(Equal(1))
		})
	})

	Describe("Execute", func() {
		var err error

		BeforeEach(func() {
			err := flagContext.Parse()