Sha256: ee794183e26c220b1daa4423dc236a835fc5524bf9aab29bc5badc7e55d92e76

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

module ThreadedRspec
  class ExampleGroupRunner < Spec::Runner::ExampleGroupRunner
    def initialize(options, thread_count)
      super(options)
      @options = options
      @thread_count = thread_count.to_i
    end

    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(@options) while !queue.empty?
        end
      end
      threads.each{|t| t.join}

      success
    ensure
      finish
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
GICodeWarrior-threaded-rspec-0.6.0 lib/threaded_rspec/example_group_runner.rb