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

- old
+ new

@@ -38,13 +38,25 @@ assert(port.positive?) pool.release(port) end def test_acquires_and_releases_in_block - Pool.new.acquire do |port| + result = Pool.new.acquire do |port| assert(!port.nil?) assert(port.positive?) + 123 end + assert_equal(123, result) + end + + def test_acquires_and_releases_safely + pool = Pool.new + assert_raises do + pool.acquire do + raise 'Itended' + end + end + assert(pool.count.zero?) end def test_acquires_and_releases_from_singleton Pool::SINGLETON.acquire do |port| assert(!port.nil?)