class Gurke::FeatureList

A {FeatureList} is a list of {Feature} objects.

Public Instance Methods

filter(options, files) click to toggle source

@api private

# File lib/gurke/feature_list.rb, line 28
def filter(options, files)
  list   = FeatureList.new
  filter = Filter.new options, files

  each do |feature|
    file, _lines = files.select {|f, _| f == feature.file }.first
    next unless file

    f = Feature.new(feature)

    feature.scenarios.each do |scenario|
      f.scenarios << scenario unless filter.filtered?(scenario)
    end

    list << f if f.scenarios.any?
  end

  list
end
run(runner, reporter) click to toggle source

Run all features from this list.

@return [Boolean] False if any scenario has failed.

@api private

# File lib/gurke/feature_list.rb, line 15
def run(runner, reporter)
  reporter.invoke :before_features, self

  runner.hook(:features, nil, nil) do
    run_features runner, reporter
  end

  reporter.invoke :after_features, self

  !any?(&:failed?)
end

Private Instance Methods

run_features(runner, reporter) click to toggle source
# File lib/gurke/feature_list.rb, line 50
def run_features(runner, reporter)
  reporter.invoke :start_features, self

  each do |feature|
    feature.run runner, reporter
  end
rescue Interrupt # rubocop:disable HandleExceptions
  # nothing
ensure
  reporter.invoke :end_features, self
end