Sha256: 5a261472cb0c0ca7202d37bc8d57077e1d2ec977447be74d2e62aa6f63621875
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
require 'test_queue/runner' require 'rspec/core' module RSpec::Core class QueueRunner < CommandLine def initialize super(ARGV) @configuration.output_stream = $stdout @configuration.error_stream = $stderr end def example_groups @options.configure(@configuration) @configuration.load_spec_files @world.announce_filters @world.example_groups end def run_each(iterator) @configuration.reporter.report(0, @configuration.randomize? ? @configuration.seed : nil) do |reporter| begin @configuration.run_hook(:before, :suite) iterator.map {|g| print " #{g.description}: " start = Time.now ret = g.run(reporter) diff = Time.now-start puts(" <%.3f>" % diff) ret }.all? ? 0 : @configuration.failure_exit_code ensure @configuration.run_hook(:after, :suite) end end end end end module TestQueue class Runner class RSpec < Runner def initialize @rspec = ::RSpec::Core::QueueRunner.new super(@rspec.example_groups.sort_by{ |s| -(stats[s.description] || 0) }) end def run_worker(iterator) @rspec.run_each(iterator) end def summarize_worker(worker) worker.stats.each do |s, val| stats[s.description] = val end num_tests = worker.lines.grep(/ examples?, /).first failures = worker.output[/^Failures:\n\n(.*)\n^Finished/m, 1] [ num_tests, failures ] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
test-queue-0.2.0 | lib/test_queue/runner/rspec.rb |
test-queue-0.2.0.beta.1 | lib/test_queue/runner/rspec.rb |
test-queue-0.1.3 | lib/test_queue/runner/rspec.rb |