コード例 #1
0
				It("notifies the user that the migration was successful", func() {
					serviceRepo.ServiceInstanceCountForServicePlan = 2
					testcmd.RunCommand(cmd, args, requirementsFactory)

					Expect(ui.Outputs).To(ContainSubstrings(
						[]string{"Attempting to migrate", "2", "service instances"},
						[]string{"1", "service instance", "migrated"},
						[]string{"OK"},
					))
				})
			})

			Context("when finding the v1 plan fails", func() {
				Context("because the plan does not exist", func() {
					BeforeEach(func() {
						serviceRepo.FindServicePlanByDescriptionResponses = []error{errors.NewModelNotFoundError("Service Plan", "")}
					})

					It("notifies the user of the failure", func() {
						testcmd.RunCommand(cmd, args, requirementsFactory)

						Expect(ui.Outputs).To(ContainSubstrings(
							[]string{"FAILED"},
							[]string{"Plan", "v1-service-label", "v1-provider-name", "v1-plan-name", "cannot be found"},
						))
					})

					It("does not display the warning", func() {
						testcmd.RunCommand(cmd, args, requirementsFactory)

						Expect(ui.Outputs).ToNot(ContainSubstrings([]string{"WARNING:", "this operation is to replace a service broker"}))