diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-02-19 00:08:16 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-02-19 00:08:16 +0900 |
commit | 18c57c79ef7728aeb7f5a13f9136958a0d62ee1b (patch) | |
tree | 641430f11bc7a6ef62de346fe4283b444197f9e8 /activesupport/lib/active_support/testing | |
parent | 57b0ae8011ab0502253631bd6fdbc0fc838b593e (diff) | |
download | rails-18c57c79ef7728aeb7f5a13f9136958a0d62ee1b.tar.gz rails-18c57c79ef7728aeb7f5a13f9136958a0d62ee1b.tar.bz2 rails-18c57c79ef7728aeb7f5a13f9136958a0d62ee1b.zip |
Bump up minitest dependency and remove our own reinvented version of ParallelEach
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r-- | activesupport/lib/active_support/testing/isolation.rb | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb index dca91e8b75..d70d971538 100644 --- a/activesupport/lib/active_support/testing/isolation.rb +++ b/activesupport/lib/active_support/testing/isolation.rb @@ -1,8 +1,5 @@ require 'rbconfig' -begin - require 'minitest/parallel_each' -rescue LoadError -end +require 'minitest/parallel_each' module ActiveSupport module Testing @@ -48,39 +45,6 @@ module ActiveSupport module Isolation require 'thread' - # Recent versions of MiniTest (such as the one shipped with Ruby 2.0) already define - # a ParallelEach class. - unless defined? ParallelEach - class ParallelEach - include Enumerable - - # default to 2 cores - CORES = (ENV['TEST_CORES'] || 2).to_i - - def initialize list - @list = list - @queue = SizedQueue.new CORES - end - - def grep pattern - self.class.new super - end - - def each - threads = CORES.times.map { - Thread.new { - while job = @queue.pop - yield job - end - } - } - @list.each { |i| @queue << i } - CORES.times { @queue << nil } - threads.each(&:join) - end - end - end - def self.included(klass) #:nodoc: klass.extend(Module.new { def test_methods |