lib/test_queue/runner/cucumber.rb in test-queue-split-0.3.1 vs lib/test_queue/runner/cucumber.rb in test-queue-split-0.3.2

- old
+ new

@@ -18,28 +18,35 @@ module TestQueue class Runner class Cucumber < Runner def initialize - @cli = ::Cucumber::Cli::Main.new(ARGV.dup) - @runtime = ::Cucumber::Runtime.new(@cli.configuration) + @cli = ::Cucumber::Cli::Main.new(ARGV.dup) + @runtime = ::Cucumber::Runtime.new(@cli.configuration) @features_loader = @runtime.send(:features) - features = @features_loader.features.sort_by{ |s| -(stats[s.to_s] || 0) } + + features = @features_loader.is_a?(Array) ? @features_loader : @features_loader.features + features = features.sort_by { |s| -(stats[s.to_s] || 0) } super(features) end def run_worker(iterator) - @features_loader.features = iterator + if @features_loader.is_a?(Array) + @features_loader = iterator + else + @features_loader.features = iterator + end + @cli.execute!(@runtime) end def summarize_worker(worker) worker.stats.each do |s, val| stats[s.to_s] = val end - output = worker.output.gsub(/\e\[\d+./,'') - worker.summary = output.split("\n").grep(/^\d+ (scenarios?|steps?)/).first + output = worker.output.gsub(/\e\[\d+./, '') + worker.summary = output.split("\n").grep(/^\d+ (scenarios?|steps?)/).first worker.failure_output = output.scan(/^Failing Scenarios:\n(.*)\n\d+ scenarios?/m).join("\n") end end end end