Sha256: 62e23dcd07a1db129ff2d64a79c22b9d1ba8a0124f09097f2842008b24b48f0a

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

require 'turnip/node/scenario_group_definition'

module Turnip
  module Node
    #
    # @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
    #     }
    #
    class Rule < ScenarioGroupDefinition
      def children
        @children ||= @raw[:children].map do |child|
          unless child[:background].nil?
            next Background.new(child[:background])
          end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip-4.0.1 lib/turnip/node/rule.rb
turnip-4.0.0 lib/turnip/node/rule.rb