2014-02-06 21:05:45 -05:00
|
|
|
Thread.abort_on_exception = true
|
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
class TestConnectionPoolTimedStack < Minitest::Test
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@stack = ConnectionPool::TimedStack.new { Object.new }
|
|
|
|
end
|
|
|
|
|
2014-02-06 21:10:29 -05:00
|
|
|
def test_empty_eh
|
|
|
|
assert_empty @stack
|
|
|
|
|
|
|
|
@stack.push Object.new
|
|
|
|
|
|
|
|
refute_empty @stack
|
|
|
|
end
|
|
|
|
|
2014-02-06 21:07:58 -05:00
|
|
|
def test_pop
|
|
|
|
e = assert_raises Timeout::Error do
|
|
|
|
@stack.pop 0.0000001
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_match %r%Waited [\de.-]+ sec%, e.message
|
|
|
|
end
|
|
|
|
|
2014-02-06 21:09:45 -05:00
|
|
|
def test_push
|
|
|
|
assert_empty @stack
|
|
|
|
|
|
|
|
@stack.push Object.new
|
|
|
|
|
|
|
|
refute_empty @stack
|
|
|
|
end
|
|
|
|
|
2014-02-06 21:05:45 -05:00
|
|
|
end
|
|
|
|
|