mirror of
https://github.com/mperham/connection_pool
synced 2023-03-27 23:22:21 -04:00
Test Wrapper#with
This commit is contained in:
parent
2357c9c427
commit
ee015a7318
1 changed files with 14 additions and 0 deletions
|
@ -260,4 +260,18 @@ class TestConnectionPool < Minitest::Test
|
|||
assert_respond_to wrapper, :fast
|
||||
refute_respond_to wrapper, :"nonexistent method"
|
||||
end
|
||||
|
||||
def test_wrapper_with
|
||||
wrapper = ConnectionPool::Wrapper.new(:size => 1) { Object.new }
|
||||
|
||||
wrapper.with do
|
||||
assert_raises Timeout::Error do
|
||||
Thread.new do
|
||||
wrapper.with { flunk 'connection checked out :(' }
|
||||
end.join
|
||||
end
|
||||
end
|
||||
|
||||
assert Thread.new { wrapper.with { } }.join
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue