Class: Gurke::FeatureList

Inherits:
Array
  • Object
show all
Defined in:
lib/gurke/feature_list.rb

Overview

A FeatureList is a list of Feature objects.

Defined Under Namespace

Classes: Filter

Instance Method Summary collapse

Instance Method Details

#filter(options, files) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Run all features from this list.

Returns:

  • (Boolean)

    False if any scenario has failed.



15
16
17
18
19
20
21
22
23
24
25
# 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