Пример #1
0
				fakeAgentClient.StopReturns(errors.New("fake-stop-error"))
			})

			It("returns an error", func() {
				err := vm.Stop()
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring("fake-stop-error"))
			})
		})
	})

	Describe("Apply", func() {
		It("sends apply spec to the agent", func() {
			err := vm.Apply(applySpec)
			Expect(err).ToNot(HaveOccurred())
			Expect(fakeAgentClient.ApplyArgsForCall(0)).To(Equal(applySpec))
		})

		Context("when sending apply spec to the agent fails", func() {
			BeforeEach(func() {
				fakeAgentClient.ApplyReturns(errors.New("fake-agent-apply-err"))
			})

			It("returns an error", func() {
				err := vm.Apply(applySpec)
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring("fake-agent-apply-err"))
			})
		})
	})