コード例 #1
0
		Context("when the receptor returns an error", func() {
			It("outputs error messages when trying to remove the app", func() {
				fakeAppRunner.RemoveAppReturns(errors.New("Major Fault"))
				args := []string{"cool-web-app"}

				test_helpers.ExecuteCommandWithArgs(removeCommand, args)

				Expect(outputBuffer).To(test_helpers.Say("Error stopping cool-web-app: Major Fault"))
				Expect(fakeAppRunner.RemoveAppCallCount()).To(Equal(1))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})

			It("outputs error messages when trying to remove the app", func() {
				fakeAppRunner.RemoveAppStub = func(name string) error {
					if name == "app2" {
						return errors.New("Major Fault")
					}
					return nil
				}

				args := []string{
					"app1",
					"app2",
					"app3",
				}

				test_helpers.ExecuteCommandWithArgs(removeCommand, args)

				Expect(outputBuffer).To(test_helpers.SayLine("Removing app1..."))
				Expect(outputBuffer).To(test_helpers.SayLine("Removing app2..."))
				Expect(outputBuffer).To(test_helpers.SayLine("Error stopping app2: Major Fault"))
				Expect(outputBuffer).To(test_helpers.SayLine("Removing app3..."))