Exemplo n.º 1
0
			requirementsFactory.TargetedSpaceSuccess = false
			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"))
		})