Sha256: 1c9482b77ece95b54a67e33f7da4fc10e9f63fd95488df5e4eb78ddf22a2c07d
Contents?: true
Size: 1.61 KB
Versions: 6
Compression:
Stored size: 1.61 KB
Contents
require 'turnip/node/base' require 'turnip/node/tag' require 'turnip/node/scenario' require 'turnip/node/scenario_outline' require 'turnip/node/background' module Turnip module Node # # @note Feature metadata generated by Gherkin # # { # type: :Feature, # tags: [], # Array of Tag # location: { line: 10, column: 3 }, # language: 'en', # keyword: 'Feature', # name: 'Feature name', # description: 'Feature description', # children: [], # Array of Background, Scenario and Scenario Outline # } # class Feature < Base include HasTags def name @raw[:name] end def language @raw[:language] end def keyword @raw[:keyword] end def description @raw[:description] end def children @children ||= @raw[:children].map do |c| case c[:type] when :Background Background.new(c) when :Scenario Scenario.new(c) when :ScenarioOutline ScenarioOutline.new(c) end end.compact end def backgrounds @backgrounds ||= children.select do |c| c.is_a?(Background) end end def scenarios @scenarios ||= children.map do |c| case c when Scenario c when ScenarioOutline c.to_scenarios end end.flatten.compact end def metadata_hash super.merge(:type => Turnip.type, :turnip => true) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems