Sha256: 49ace71ca8b952b81e705455376d5bfa54037fac3b5a730947d4d763691966ca

Contents?: true

Size: 656 Bytes

Versions: 69

Compression:

Stored size: 656 Bytes

Contents

class MultiThreadedExampleGroupRunner < Spec::Runner::ExampleGroupRunner
  def initialize(options, arg)
    super(options)
    # configure these
    @thread_count = 4
    @thread_wait = 0
  end

  def run
    @threads = []
    q = Queue.new
    example_groups.each { |b| q << b}
    success = true
    @thread_count.times do
      @threads << Thread.new(q) do |queue|
        while not queue.empty?
          example_group = queue.pop
          success &= example_group.suite.run(nil)
        end
      end
      sleep @thread_wait
    end
    @threads.each {|t| t.join}
    success
  end
end

MultiThreadedBehaviourRunner = MultiThreadedExampleGroupRunner

Version data entries

69 entries across 69 versions & 9 rubygems

Version Path
rspec-1.1.7 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.4 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.3 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.2 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.11 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.6 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.8 examples/pure/multi_threaded_behaviour_runner.rb
rspec-1.1.9 examples/pure/multi_threaded_behaviour_runner.rb
spree-0.2.0 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
spree-0.4.1 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
spree-0.4.0 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
spree-0.5.0 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
spree-0.6.0 vendor/plugins/rspec/examples/passing/multi_threaded_behaviour_runner.rb
spree-0.5.1 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
spree-0.7.1 vendor/plugins/rspec/examples/passing/multi_threaded_behaviour_runner.rb
spree-0.7.0 vendor/plugins/rspec/examples/passing/multi_threaded_behaviour_runner.rb
spree-0.8.0 vendor/plugins/rspec/examples/passing/multi_threaded_behaviour_runner.rb
spree-0.8.1 vendor/plugins/rspec/examples/passing/multi_threaded_behaviour_runner.rb
typo-5.0.1 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
typo-5.0.2 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb