Class: TestQueue::Runner::RSpec
- Inherits:
-
TestQueue::Runner
- Object
- TestQueue::Runner
- TestQueue::Runner::RSpec
- Defined in:
- lib/test_queue/runner/rspec.rb
Instance Attribute Summary
Attributes inherited from TestQueue::Runner
Instance Method Summary collapse
-
#initialize ⇒ RSpec
constructor
A new instance of RSpec.
- #run_worker(iterator) ⇒ Object
- #summarize_worker(worker) ⇒ Object
Methods inherited from TestQueue::Runner
#after_fork, #after_fork_internal, #around_filter, #cleanup_worker, #connect_to_relay, #distribute_queue, #execute, #execute_parallel, #execute_sequential, #prepare, #reap_worker, #relay?, #relay_to_master, #spawn_workers, #start_master, #start_relay, #stats, #stats_file, #stop_master, #summarize, #summarize_internal, #worker_completed
Constructor Details
#initialize ⇒ RSpec
Returns a new instance of RSpec.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/test_queue/runner/rspec.rb', line 16 def initialize @rspec = ::RSpec::Core::QueueRunner.new @split_groups = ENV['TEST_QUEUE_SPLIT_GROUPS'] && ENV['TEST_QUEUE_SPLIT_GROUPS'].strip.downcase == 'true' if @split_groups groups = @rspec.example_groups groups_to_split, groups_to_keep = [], [] groups.each do |group| (group.[:no_split] ? groups_to_keep : groups_to_split) << group end queue = groups_to_split.map(&:descendant_filtered_examples).flatten queue.concat groups_to_keep queue.sort_by!{ |s| -(stats[s.id] || 0) } else queue = @rspec.example_groups.sort_by{ |s| -(stats[s.to_s] || 0) } end super(queue) end |
Instance Method Details
#run_worker(iterator) ⇒ Object
36 37 38 |
# File 'lib/test_queue/runner/rspec.rb', line 36 def run_worker(iterator) @rspec.run_each(iterator).to_i end |
#summarize_worker(worker) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/test_queue/runner/rspec.rb', line 40 def summarize_worker(worker) worker.stats.each do |s, val| stats[s] = val end worker.summary = worker.lines.grep(/ examples?, /).first worker.failure_output = worker.output[/^Failures:\n\n(.*)\n^Finished/m, 1] end |