Sha256: e5d0dfbc435a4adc54c2b2a128ec5220cab9ed1d0ff7cdaafe3bc06a3f31616b

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'cucumber/core/gherkin/tag_expression'
require 'cucumber/runtime'
require 'cucumber'
require 'parallel_tests/cucumber/scenario_line_logger'
require 'parallel_tests/gherkin/listener'

module ParallelTests
  module Cucumber
    class Scenarios
      class << self
        def all(files, options={})
          tags = []
          tags.concat options[:ignore_tag_pattern].to_s.split(/\s*,\s*/).map {|tag| "~#{tag}" }
          tags.concat options[:test_options].to_s.scan(/(?:-t|--tags) (~?@[\w,~@]+)/).flatten
          split_into_scenarios files, tags.uniq
        end

        private

        def split_into_scenarios(files, tags=[])
          tag_expression = ::Gherkin::TagExpression.new(tags)
          scenario_line_logger = ParallelTests::Cucumber::Formatters::ScenarioLineLogger.new(tag_expression)
          loader = ::Cucumber::Runtime::FeaturesLoader.new(files, [], tag_expression)

          loader.features.each do |feature|
            feature.accept(scenario_line_logger)
          end

          scenario_line_logger.scenarios
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
parallel_tests-2.10.0 lib/parallel_tests/cucumber/scenarios.rb
parallel_tests-2.9.0 lib/parallel_tests/cucumber/scenarios.rb
parallel_tests-2.8.0 lib/parallel_tests/cucumber/scenarios.rb
parallel_tests-2.7.1 lib/parallel_tests/cucumber/scenarios.rb
parallel_tests-2.7.0 lib/parallel_tests/cucumber/scenarios.rb
parallel_tests-2.6.0 lib/parallel_tests/cucumber/scenarios.rb