Exemplo n.º 1
0
			})
		})
	})

	Describe("SyncCommand", func() {
		var syncCommand cli.Command

		BeforeEach(func() {
			syncCommand = commandFactory.MakeSyncCommand()
		})

		It("should sync ltc", func() {
			test_helpers.ExecuteCommandWithArgs(syncCommand, []string{})

			Expect(outputBuffer).To(test_helpers.SayLine("Updated ltc to the latest version."))
			Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(1))
			actualLTCPath, actualArch, actualConfig := fakeVersionManager.SyncLTCArgsForCall(0)
			Expect(actualLTCPath).To(Equal("/fake/ltc"))
			Expect(actualArch).To(Equal("osx"))
			Expect(actualConfig).To(Equal(config))
		})

		Context("when not targeted", func() {
			It("should print an error", func() {
				config.SetTarget("")

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

				Expect(outputBuffer).To(test_helpers.SayLine("Error: Must be targeted to sync."))
				Expect(fakeVersionManager.SyncLTCCallCount()).To(Equal(0))
				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))