Class: ThreadedRspec::ExampleGroupRunner
- Inherits:
-
Spec::Runner::ExampleGroupRunner
- Object
- Spec::Runner::ExampleGroupRunner
- ThreadedRspec::ExampleGroupRunner
- Defined in:
- lib/threaded_rspec/example_group_runner.rb
Instance Method Summary collapse
-
#initialize(options, thread_count) ⇒ ExampleGroupRunner
constructor
A new instance of ExampleGroupRunner.
- #run ⇒ Object
Constructor Details
#initialize(options, thread_count) ⇒ ExampleGroupRunner
3 4 5 6 7 |
# File 'lib/threaded_rspec/example_group_runner.rb', line 3 def initialize(, thread_count) super() = @thread_count = thread_count.to_i end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/threaded_rspec/example_group_runner.rb', line 9 def run prepare queue = Queue.new example_groups.each{|g| queue << g} success = true threads = [] @thread_count.times do threads << Thread.new do success &= queue.pop.run() while !queue.empty? end end threads.each{|t| t.join} success ensure finish end |