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
dchelimsky-rspec-1.1.10 examples/pure/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11.1 examples/passing/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11.2 examples/passing/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11.3 examples/passing/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11.4 examples/passing/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11.5 examples/passing/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11.6 examples/passing/multi_threaded_behaviour_runner.rb
dchelimsky-rspec-1.1.11 examples/passing/multi_threaded_behaviour_runner.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/pure/multi_threaded_behaviour_runner.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/pure/multi_threaded_behaviour_runner.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/pure/multi_threaded_behaviour_runner.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/pure/multi_threaded_behaviour_runner.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/pure/multi_threaded_behaviour_runner.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/pure/multi_threaded_behaviour_runner.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
picolena-0.1.0 rails_plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb