Class: JCukeForker::Formatters::ScenarioLineLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/jcukeforker/formatters/scenario_line_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_expression = Gherkin::TagExpression.new([])) ⇒ ScenarioLineLogger



7
8
9
10
# File 'lib/jcukeforker/formatters/scenario_line_logger.rb', line 7

def initialize(tag_expression = Gherkin::TagExpression.new([]))
  @scenarios = []
  @tag_expression = tag_expression
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



24
25
# File 'lib/jcukeforker/formatters/scenario_line_logger.rb', line 24

def method_missing(*args)
end

Instance Attribute Details

#scenariosObject (readonly)

Returns the value of attribute scenarios.



5
6
7
# File 'lib/jcukeforker/formatters/scenario_line_logger.rb', line 5

def scenarios
  @scenarios
end

Instance Method Details

#visit_feature_element(feature_element) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jcukeforker/formatters/scenario_line_logger.rb', line 12

def visit_feature_element(feature_element)
  if @tag_expression.evaluate(feature_element.source_tags)
    line_number = if feature_element.respond_to?(:line)
                    feature_element.line
                  else
                    feature_element.location.line
                  end

    @scenarios << [feature_element.feature.file, line_number].join(':')
  end
end