Пример #1
0
			requirementsFactory.NewTargetedSpaceRequirementReturns(requirements.Failing{Message: "not targeted"})
			Expect(callCreateService([]string{"cleardb", "spark", "my-cleardb-service"})).To(BeFalse())
		})
	})

	It("successfully creates a service", func() {
		callCreateService([]string{"cleardb", "spark", "my-cleardb-service"})

		spaceGUID, serviceName := serviceBuilder.GetServicesByNameForSpaceWithPlansArgsForCall(0)
		Expect(spaceGUID).To(Equal(config.SpaceFields().GUID))
		Expect(serviceName).To(Equal("cleardb"))
		Expect(ui.Outputs()).To(ContainSubstrings(
			[]string{"Creating service instance", "my-cleardb-service", "my-org", "my-space", "my-user"},
			[]string{"OK"},
		))
		name, planGUID, _, _ := serviceRepo.CreateServiceInstanceArgsForCall(0)
		Expect(name).To(Equal("my-cleardb-service"))
		Expect(planGUID).To(Equal("cleardb-spark-guid"))
	})

	Context("when passing in tags", func() {
		It("sucessfully creates a service and passes the tags as json", func() {
			callCreateService([]string{"cleardb", "spark", "my-cleardb-service", "-t", "tag1, tag2,tag3,  tag4"})

			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Creating service instance", "my-cleardb-service", "my-org", "my-space", "my-user"},
				[]string{"OK"},
			))
			_, _, _, tags := serviceRepo.CreateServiceInstanceArgsForCall(0)
			Expect(tags).To(ConsistOf("tag1", "tag2", "tag3", "tag4"))
		})