Пример #1
0
						Ω(sleeper.SleepArgsForCall(1)).Should(Equal(2 * time.Second))

						Ω(retryPolicy.DelayForArgsForCall(2)).Should(Equal(uint(3)))
						Ω(sleeper.SleepArgsForCall(2)).Should(Equal(1000 * time.Second))

						Ω(errResult).Should(Equal(retryableError))
					})
				})
			})
		}

		Context("when the error is not retryable", func() {
			var returnedErr error

			BeforeEach(func() {
				retryPolicy.DelayForReturns(0, true)

				returnedErr = errors.New("oh no!")
				resultIn(returnedErr)
			})

			It("propagates the error", func() {
				Ω(errResult).Should(Equal(returnedErr))
			})

			It("does not retry", func() {
				Ω(attempts()).Should(Equal(1))
			})
		})

		Context("when there is no error", func() {