Ejemplo n.º 1
0
		It("fails when not logged in", func() {
			requirementsFactory.LoginSuccess = false
			callUpdateService([]string{"cleardb", "spark", "my-cleardb-service"})
			Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
		})

		It("fails when a space is not targeted", func() {
			requirementsFactory.TargetedSpaceSuccess = false
			callUpdateService([]string{"cleardb", "spark", "my-cleardb-service"})
			Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
		})
	})
	Context("when no flags are passed", func() {
		Context("when there is an err finding the instance", func() {
			It("returns an error", func() {
				serviceRepo.FindInstanceByNameErr = true

				callUpdateService([]string{"some-stupid-not-real-instance"})

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Error finding instance"},
					[]string{"FAILED"},
				))
			})
		})
		Context("when the instance exists", func() {
			It("prints a user indicating it is a no-op", func() {
				callUpdateService([]string{"my-service"})

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"OK"},