Skip to content

Commit

Permalink
Merge pull request lostisland#440 from rusikf/feature-4
Browse files Browse the repository at this point in the history
testing negative numbers for retries
  • Loading branch information
technoweenie committed Dec 7, 2014
2 parents 458f319 + 416a91b commit 66ee3f2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/middleware/retry_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,24 @@ def test_legacy_max_retries
assert_equal 2, @times_called
end

def test_legacy_max_negative_retries
@explode = lambda {|n| raise Errno::ETIMEDOUT }
assert_raises(Errno::ETIMEDOUT) { conn(-9).get("/unstable") }
assert_equal 1, @times_called
end

def test_new_max_retries
@explode = lambda {|n| raise Errno::ETIMEDOUT }
assert_raises(Errno::ETIMEDOUT) { conn(:max => 3).get("/unstable") }
assert_equal 4, @times_called
end

def test_new_max_negative_retries
@explode = lambda { |n| raise Errno::ETIMEDOUT }
assert_raises(Errno::ETIMEDOUT) { conn(:max => -9).get("/unstable") }
assert_equal 1, @times_called
end

def test_interval
@explode = lambda {|n| raise Errno::ETIMEDOUT }
started = Time.now
Expand Down

0 comments on commit 66ee3f2

Please sign in to comment.