Skip to content

Instantly share code, notes, and snippets.

@rickhull
Created July 31, 2013 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickhull/953a26c82487d11d0ed3 to your computer and use it in GitHub Desktop.
Save rickhull/953a26c82487d11d0ed3 to your computer and use it in GitHub Desktop.
wh@UbuntuVM:~$ ruby test_retryable.rb
Run options: --seed 65041
# Running tests:
E
Finished tests in 1.001122s, 0.9989 tests/s, 0.0000 assertions/s.
1) Error:
test_0001_must_retry_according_to_tries(retryable):
RuntimeError: failed
test_retryable.rb:13:in `block (4 levels) in <main>'
/usr/lib/ruby/gems/1.9.1/gems/retryable-1.3.3/lib/retryable.rb:17:in `retryable'
test_retryable.rb:11:in `block (3 levels) in <main>'
test_retryable.rb:16:in `call'
test_retryable.rb:16:in `block (2 levels) in <main>'
1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
require 'minitest/autorun'
require 'minitest/spec'
require 'retryable'
describe "retryable" do
it "must retry according to :tries" do
num_tries = 2
actual_tries = 0
retry_proc = proc {
retryable(tries: num_tries) {
actual_tries += 1
raise "failed"
}
}
retry_proc.call.must_raise RuntimeError
actual_tries.must_equal num_tries
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment