Exemple #1
0
		It("send the set grace time request", func() {
			graceTime := time.Second * 5

			Ω(container.SetGraceTime(graceTime)).Should(Succeed())

			Ω(fakeConnection.SetGraceTimeCallCount()).Should(Equal(1))
			handle, actualGraceTime := fakeConnection.SetGraceTimeArgsForCall(0)
			Ω(handle).Should(Equal("some-handle"))
			Ω(actualGraceTime).Should(Equal(graceTime))
		})

		Context("when the request fails", func() {
			disaster := errors.New("banana")

			BeforeEach(func() {
				fakeConnection.SetGraceTimeReturns(disaster)
			})

			It("returns the error", func() {
				err := container.SetGraceTime(time.Second * 5)
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	Context("when the request fails", func() {
		disaster := errors.New("oh no!")

		BeforeEach(func() {
			fakeConnection.NetOutReturns(disaster)
		})