Class: CukeSlicer::FileExtractor

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

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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cuke_slicer/extractors/file_extractor.rb', line 12

def extract(target, filters, format, &block)
  Array.new.tap do |test_cases|
    unless target.feature.nil?
      tests = target.feature.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