Class: CucumberFM::Aggregator

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber_f_m/aggregator.rb

Defined Under Namespace

Classes: Collection, ScenarioCollection

Instance Method Summary collapse

Constructor Details

#initialize(cfm, aggregator, multiple = false) ⇒ Aggregator

Returns a new instance of Aggregator.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cucumber_f_m/aggregator.rb', line 3

def initialize(cfm, aggregator, multiple = false)
  if multiple
    @collection = Collection.nested_hash(0)
    multiple.each do |tag|
      cfm.scenarios.each do |scenario|
        @collection[tag].push scenario if scenario.tags.include?(tag)
      end
    end
  else
    @collection = Collection.nested_hash(aggregator.size)
    if aggregator.size == 2
      cfm.scenarios.each do |scenario|
        @collection[label(aggregator.first, scenario.tags_without_technical)][label(aggregator.last, scenario.tags_without_technical)][scenario.feature].push scenario
      end
    else
      @collection = Collection.nested_hash(1)
      cfm.scenarios.each do |scenario|
        @collection[label(aggregator.first, scenario.tags_without_technical)][scenario.feature].push scenario
      end
    end
  end
end

Instance Method Details

#collectionObject



26
27
28
# File 'lib/cucumber_f_m/aggregator.rb', line 26

def collection
  @collection
end