Esempio n. 1
0
	"github.com/cloudfoundry/cli/cf/api"
	"github.com/cloudfoundry/cli/cf/commands/space"
	"github.com/cloudfoundry/cli/cf/models"
	"github.com/cloudfoundry/cli/cf/requirements"
	"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
	"github.com/cloudfoundry/cli/flags"
	. "github.com/cloudfoundry/cli/testhelpers/matchers"
)

var _ = Describe("space command", func() {
	var (
		ui               *testterm.FakeUI
		loginReq         *requirementsfakes.FakeRequirement
		targetedOrgReq   *requirementsfakes.FakeTargetedOrgRequirement
		reqFactory       *requirementsfakes.FakeFactory
		deps             commandregistry.Dependency
		cmd              space.ShowSpace
		flagContext      flags.FlagContext
		getSpaceModel    *plugin_models.GetSpace_Model
		spaceRequirement *requirementsfakes.FakeSpaceRequirement
		quotaRepo        *spacequotasfakes.FakeSpaceQuotaRepository
	)

	BeforeEach(func() {
		ui = new(testterm.FakeUI)
		quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
		repoLocator := api.RepositoryLocator{}
		repoLocator = repoLocator.SetSpaceQuotaRepository(quotaRepo)
		getSpaceModel = new(plugin_models.GetSpace_Model)

		deps = commandregistry.Dependency{
			UI:          ui,
Esempio n. 2
0
	"github.com/cloudfoundry/cli/cf/commands/spacequota"
	"github.com/cloudfoundry/cli/cf/flags"
	. "github.com/cloudfoundry/cli/testhelpers/matchers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("create-space-quota", func() {
	var (
		ui                  *testterm.FakeUI
		quotaRepo           *spacequotasfakes.FakeSpaceQuotaRepository
		requirementsFactory *requirementsfakes.FakeFactory
		config              *coreconfigfakes.FakeRepository

		loginReq         *requirementsfakes.FakeRequirement
		targetedOrgReq   *requirementsfakes.FakeTargetedOrgRequirement
		minApiVersionReq *requirementsfakes.FakeRequirement
		reqFactory       *requirementsfakes.FakeFactory

		deps        commandregistry.Dependency
		cmd         spacequota.CreateSpaceQuota
		flagContext flags.FlagContext
	)

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
		requirementsFactory = new(requirementsfakes.FakeFactory)
		config = new(coreconfigfakes.FakeRepository)

		repoLocator := api.RepositoryLocator{}
Esempio n. 3
0
package requirements_test

import (
	. "github.com/cloudfoundry/cli/cf/requirements"

	"errors"
	"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Requirements", func() {
	Context("When there are multiple requirements", func() {
		It("executes all the requirements", func() {
			r1 := new(requirementsfakes.FakeRequirement)
			r1.ExecuteReturns(nil)
			r2 := new(requirementsfakes.FakeRequirement)
			r2.ExecuteReturns(nil)

			// SETUP
			requirements := Requirements{
				r1,
				r2,
			}

			// EXECUTE
			err := requirements.Execute()

			// ASSERT
			Expect(err).NotTo(HaveOccurred())
			Expect(r1.ExecuteCallCount()).To(Equal(1))