예제 #1
0
파일: push_test.go 프로젝트: juggernaut/cli
		It("fails when given the name of an app that is not in the manifest", func() {
			callPush("non-existant-app")
			testassert.SliceContains(ui.Outputs, testassert.Lines{
				{"Failed"},
			})
			Expect(len(appRepo.CreateAppParams)).To(Equal(0))
		})
	})

	It("binds service instances to the app", func() {
		appRepo.ReadNotFound = true

		serviceRepo.FindInstanceByNameMap = generic.NewMap(map[interface{}]interface{}{
			"global-service": maker.NewServiceInstance("global-service"),
			"app1-service":   maker.NewServiceInstance("app1-service"),
			"app2-service":   maker.NewServiceInstance("app2-service"),
		})

		manifestRepo.ReadManifestReturns.Manifest = manifestWithServicesAndEnv()

		callPush()
		Expect(len(binder.AppsToBind)).To(Equal(4))
		Expect(binder.AppsToBind[0].Name).To(Equal("app1"))
		Expect(binder.AppsToBind[1].Name).To(Equal("app1"))
		Expect(binder.InstancesToBindTo[0].Name).To(Equal("app1-service"))
		Expect(binder.InstancesToBindTo[1].Name).To(Equal("global-service"))

		Expect(binder.AppsToBind[2].Name).To(Equal("app2"))
		Expect(binder.AppsToBind[3].Name).To(Equal("app2"))
		Expect(binder.InstancesToBindTo[2].Name).To(Equal("app2-service"))