test/test_pool.rb in random-port-0.3.2 vs test/test_pool.rb in random-port-0.4.0
- old
+ new
@@ -69,9 +69,17 @@
total = 25
numbers = (0..total - 1).map { Pool::SINGLETON.acquire }
assert_equal(total, numbers.uniq.count)
end
+ def test_raises_when_too_many
+ pool = Pool.new(limit: 1)
+ pool.acquire
+ assert_raises Pool::Timeout do
+ pool.acquire(timeout: 0.1)
+ end
+ end
+
def test_acquires_unique_numbers_in_no_sync_mode
total = 25
pool = Pool.new(sync: false)
numbers = (0..total - 1).map { pool.acquire }
assert_equal(total, numbers.uniq.count)