Sha256: c506667b232dc4981e720f80ebccbeb09e32fee9ab75a7f95695a40ba00fa50b

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'cucumber'
require 'cucumber/rspec/disable_option_parser'
require 'cucumber/cli/main'

module Cucumber
  module Ast
    class Features
      attr_accessor :features
    end

    class Feature
      def to_s
        title
      end
    end
  end
end

module TestQueue
  class Runner
    class Cucumber < Runner
      def initialize
        @cli             = ::Cucumber::Cli::Main.new(ARGV.dup)
        @runtime         = ::Cucumber::Runtime.new(@cli.configuration)
        @features_loader = @runtime.send(:features)

        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)
        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
        worker.failure_output = output.scan(/^Failing Scenarios:\n(.*)\n\d+ scenarios?/m).join("\n")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test-queue-split-0.3.2 lib/test_queue/runner/cucumber.rb