Class: CukeIterations::ScenarioExtractingFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/cuke_iterations/scenario_extracting_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScenarioExtractingFormatter

Returns a new instance of ScenarioExtractingFormatter.



5
6
7
8
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 5

def initialize
  @discovered_scenarios = []
  @feature_tags = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



36
37
38
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 36

def method_missing(sym, *args, &block)
  # We don't care
end

Instance Attribute Details

#discovered_scenariosObject (readonly)

Returns the value of attribute discovered_scenarios.



3
4
5
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 3

def discovered_scenarios
  @discovered_scenarios
end

Instance Method Details

#examples(examples) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 25

def examples(examples)
  examples.rows.each do |row|
    next if row == examples.rows.first

    @discovered_scenarios << {
        line: row.line,
        tags: @feature_tags + @outline_tags + examples.tags.map { |t| t.name }
    }
  end
end

#feature(feature) ⇒ Object



10
11
12
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 10

def feature(feature)
  @feature_tags = feature.tags.map { |t| t.name }
end

#scenario(scenario) ⇒ Object



14
15
16
17
18
19
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 14

def scenario(scenario)
  @discovered_scenarios << {
      line: scenario.line,
      tags: @feature_tags + scenario.tags.map { |t| t.name }
  }
end

#scenario_outline(outline) ⇒ Object



21
22
23
# File 'lib/cuke_iterations/scenario_extracting_formatter.rb', line 21

def scenario_outline(outline)
  @outline_tags = outline.tags.map { |t| t.name }
end