Sha256: ae2af5ccfd6693ec45f34f032b15ed65306957e2ff3cd8bb3b305f8ea5160895
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
module Turnip class Feature attr_reader :scenarios, :backgrounds def initialize(raw) @raw = raw @scenarios = [] @backgrounds = [] end def name @raw.name end end class Background attr_reader :steps def initialize(raw) @raw = raw @steps = [] end end class Scenario attr_reader :name, :steps def initialize(raw) @raw = raw @steps = [] end def name @raw.name end def tags @raw.tags.map { |tag| tag.name.sub(/^@/, '').to_sym } end def tags_hash Hash[tags.map { |t| [t, true] }] end def metadata_hash tags_hash end end class Step attr_reader :name def initialize(raw) @raw = raw end def name @raw.name end end class Builder attr_reader :features def initialize @features = [] end def background(background) @current_step_context = Turnip::Background.new(background) @current_feature.backgrounds << @current_step_context end def feature(feature) @current_feature = Turnip::Feature.new(feature) @features << @current_feature end def scenario(scenario) @current_step_context = Turnip::Scenario.new(scenario) @current_feature.scenarios << @current_step_context end def step(step) @current_step = Turnip::Step.new(step) @current_step_context.steps << @current_step end def eof end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
turnip-0.1.0 | lib/turnip/builder.rb |