Sha256: b0effbaebbdc3b86e124f5ecfaf5ba6117988df92de20474890d9ea891202e3c

Contents?: true

Size: 592 Bytes

Versions: 70

Compression:

Stored size: 592 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

Version data entries

70 entries across 70 versions & 14 rubygems

Version Path
dchelimsky-rspec-1.1.11.7 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.12 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.1 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.13 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.2 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.3 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.4 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.5 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.6 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.7 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.8 examples/passing/multi_threaded_example_group_runner.rb
dchelimsky-rspec-1.1.99.9 examples/passing/multi_threaded_example_group_runner.rb
newbamboo-evented-rspec-1.1.12 examples/passing/multi_threaded_example_group_runner.rb
newbamboo-rspec-1.1.12 examples/passing/multi_threaded_example_group_runner.rb
rspec-instructure-1.3.3 examples/passing/multi_threaded_example_group_runner.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/examples/passing/multi_threaded_example_group_runner.rb
rspec-1.3.2 examples/passing/multi_threaded_example_group_runner.rb
rspec-1.3.1 examples/passing/multi_threaded_example_group_runner.rb
rspec-1.3.1.rc examples/passing/multi_threaded_example_group_runner.rb
rspec-core-2.0.0.beta.9 example_specs/passing/multi_threaded_example_group_runner.rb