class Turnip::Node::Rule

@note Rule metadata generated by Gherkin

{
  type: :Rule,
  location: { line: 10, column: 3 },
  keyword: 'Rule',
  name: 'Rule name',
  description: 'Rule description',
  children: [] # Array of Background, Scenario and Scenario Outline
}

Public Instance Methods

children() click to toggle source
# File lib/turnip/node/rule.rb, line 18
def children
  @children ||= @raw[:children].map do |child|
    unless child[:background].nil?
      next Background.new(child[:background])
    end

    unless child[:scenario].nil?
      klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
      next klass.new(child[:scenario])
    end
  end.compact
end