Sha256: f0e8de26c26433d57ec128a8ed009c80397f82f346fe748ba9e8adea4b616457
Contents?: true
Size: 795 Bytes
Versions: 2
Compression:
Stored size: 795 Bytes
Contents
require 'assert' require 'dat-worker-pool' class UseWorkerPoolTests < Assert::Context desc "defining a custom worker pool" setup do @mutex = Mutex.new @results = [] @work_pool = DatWorkerPool.new(1, 2, !!ENV['DEBUG']) do |work| @mutex.synchronize{ @results << (work * 100) } end @work_pool.start end should "be able to add work, have it processed and stop the pool" do @work_pool.add_work 1 @work_pool.add_work 5 @work_pool.add_work 2 @work_pool.add_work 4 @work_pool.add_work 3 sleep 0.1 # allow the worker threads to run @work_pool.shutdown(1) assert_includes 100, @results assert_includes 200, @results assert_includes 300, @results assert_includes 400, @results assert_includes 500, @results end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dat-worker-pool-0.5.0 | test/system/use_worker_pool_tests.rb |
dat-worker-pool-0.4.0 | test/system/use_worker_pool_tests.rb |