1
0
Fork 0
mirror of https://github.com/mperham/connection_pool synced 2023-03-27 23:22:21 -04:00
connection_pool/test/test_connection_pool_timed_stack.rb

44 lines
663 B
Ruby
Raw Normal View History

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:10:58 -05:00
def test_length
assert_equal 0, @stack.length
@stack.push Object.new
assert_equal 1, @stack.length
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