Sha256: 7843852d79639897aaf6a5d283d620779ed46f1b00459a998cc23f9c4575b86b
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
$:.unshift File.expand_path '../../lib', __FILE__ if RUBY_ENGINE == "ruby" && ENV['TRAVIS'] != 'true' require 'simplecov' SimpleCov.coverage_dir File.join('test', 'coverage') SimpleCov.start SimpleCov.command_name 'minitest' end require 'bundler' Bundler.require :default, :development, :test require 'minitest/pride' require 'minitest/autorun' require 'angelo' require 'angelo/minitest/helpers' Celluloid.logger.level = ::Logger::ERROR include Angelo::Minitest::Helpers TEST_APP_ROOT = File.expand_path '../test_app_root', __FILE__ CK = 'ANGELO_CONCURRENCY' # concurrency key DC = 5 # default concurrency CONCURRENCY = ENV.key?(CK) ? ENV[CK].to_i : DC # https://gist.github.com/tkareine/739662 # class CountDownLatch attr_reader :count def initialize(to) @count = to.to_i raise ArgumentError, "cannot count down from negative integer" unless @count >= 0 @lock = Mutex.new @condition = ConditionVariable.new end def count_down @lock.synchronize do @count -= 1 if @count > 0 @condition.broadcast if @count == 0 end end def wait @lock.synchronize do @condition.wait(@lock) while @count > 0 end end end $reactor = Reactor.new $pool = ActorPool.pool size: CONCURRENCY def obj {'foo' => 'bar', 'bar' => 123.4567890123456, 'bat' => true} end def obj_s obj.keys.reduce({}){|h,k| h[k] = obj[k].to_s; h} end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
angelo-0.4.1 | test/spec_helper.rb |
angelo-0.4.0 | test/spec_helper.rb |