Class: RailsParallel::Collector
- Inherits:
-
Object
- Object
- RailsParallel::Collector
- Includes:
- Test::Unit::Collector
- Defined in:
- lib/rails_parallel/collector.rb
Constant Summary collapse
- NAME =
'collected from the ObjectSpace'
Instance Method Summary collapse
Instance Method Details
#next_suite ⇒ Object
24 25 26 |
# File 'lib/rails_parallel/collector.rb', line 24 def next_suite @pending.shift end |
#prepare(timings, test_name) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails_parallel/collector.rb', line 9 def prepare(timings, test_name) @suites = {} ::ObjectSpace.each_object(Class) do |klass| @suites[klass.name] = klass.suite if Test::Unit::TestCase > klass end @pending = @suites.keys.sort_by do |name| [ 0 - timings.fetch(test_name, name), # runtime, descending 0 - @suites[name].size, # no. of tests, descending name ] end end |
#suite_for(name) ⇒ Object
28 29 30 |
# File 'lib/rails_parallel/collector.rb', line 28 def suite_for(name) @suites[name] end |