test/test_pool.rb in random-port-0.3.0 vs test/test_pool.rb in random-port-0.3.1

- old
+ new

@@ -50,7 +50,20 @@ Pool::SINGLETON.acquire do |port| assert(!port.nil?) assert(port.positive?) end end + + def test_acquires_unique_numbers + total = 25 + numbers = (0..total - 1).map { Pool::SINGLETON.acquire } + assert_equal(total, numbers.uniq.count) + 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) + end end end