1
0
Fork 0
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:
Eric Hodel 2014-02-14 15:52:35 -08:00
parent 2357c9c427
commit ee015a7318

View file

@ -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