Sha256: 3ef0ae8af94822fe18ad26f1608b7fe55a2f6bc5080082fd9ec4a9b56bf91c33

Contents?: true

Size: 587 Bytes

Versions: 17

Compression:

Stored size: 587 Bytes

Contents

class MultiThreadedBehaviourRunner < Spec::Runner::BehaviourRunner
  def initialize(options)
    super
    # configure these
    @thread_count = 4
    @thread_wait = 0
  end

  def run_behaviours(behaviours)
    @threads = []
    q = Queue.new
    behaviours.each { |b| q << b}
    @thread_count.times do
      @threads << Thread.new(q) do |queue|
        while not queue.empty?
          behaviour = queue.pop
          behaviour.run(@options.reporter, @options.dry_run, @options.reverse)
        end
      end
      sleep @thread_wait
    end
    @threads.each {|t| t.join}
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/examples/multi_threaded_behaviour_runner.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/examples/multi_threaded_behaviour_runner.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/examples/multi_threaded_behaviour_runner.rb
rspec-0.9.1 examples/multi_threaded_behaviour_runner.rb
rspec-0.9.2 examples/multi_threaded_behaviour_runner.rb
rspec-0.9.3 examples/multi_threaded_behaviour_runner.rb
rspec-0.9.4 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.1 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.2 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.3 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.5 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.4 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.0 examples/multi_threaded_behaviour_runner.rb
rspec-0.9.0 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.6 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.7 examples/multi_threaded_behaviour_runner.rb
rspec-1.0.8 examples/multi_threaded_behaviour_runner.rb