Exemplo n.º 1
0
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})

		Context("when the ltc binary can't be found", func() {
			It("should print an error", func() {
				commandFactory := command_factory.NewVersionCommandFactory(config, terminalUI, fakeExitHandler, "darwin", "", fakeVersionManager)
				syncCommand = commandFactory.MakeSyncCommand()

				test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: Unable to locate the ltc binary. Sync not supported."))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(0))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})

		Context("when SyncLTC fails", func() {
			It("should print an error", func() {
				fakeVersionManager.SyncLTCReturns(errors.New("failed"))

				test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

				Expect(outputBuffer).To(test_helpers.SayLine("Error: failed"))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(1))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))
			})
		})
	})
})