Class: CukeSlicer::FileExtractor

Inherits:
Object
  • Object
show all
Includes:
ExtractionHelpers
Defined in:
lib/cuke_slicer/extractors/file_extractor.rb

Overview

private

Instance Method Summary collapse

Methods included from ExtractionHelpers

#extract_runnable_block_elements, #extract_runnable_elements

Methods included from FilterHelpers

#apply_custom_filter, #filter_excluded_paths, #filter_excluded_tags, #filter_included_paths, #filter_included_tags

Methods included from MatchingHelpers

#and_filter_match, #filter_match, #matching_path?, #matching_tag?, #or_filter_match

Instance Method Details

#extract(target, filters, format, &block) ⇒ Object

private



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cuke_slicer/extractors/file_extractor.rb', line 18

def extract(target, filters, format, &block)
  [].tap do |test_cases|
    unless target.feature.nil?
      tests = target.feature.tests
      tests += target.feature.rules.flat_map(&:tests)

      runnable_elements = extract_runnable_elements(extract_runnable_block_elements(tests, filters, &block))

      runnable_elements.each do |element|
        case
          when format == :file_line
            test_cases << "#{element.get_ancestor(:feature_file).path}:#{element.source_line}"
          when format == :test_object
            test_cases << element
        end
      end
    end
  end
end