class Specific::Processor::Gherkin

Public Class Methods

new(spec) click to toggle source
# File lib/specific/processor/gherkin.rb, line 6
def initialize(spec)
  @spec = spec
end

Public Instance Methods

execute(ast) click to toggle source
# File lib/specific/processor/gherkin.rb, line 10
def execute(ast)
  ast.accept(self)
end
visit_Feature(ast_feature) click to toggle source
# File lib/specific/processor/gherkin.rb, line 14
def visit_Feature(ast_feature)
  tags = ast_feature.tags.map do |ast_tag|
    Specific::Tag.new(ast_tag.name)
  end

  scenarios = ast_feature.scenarios.map do |ast_scenario|
    steps = ast_scenario.steps.map do |ast_step|
      Specific::Step.new(ast_step.keyword, ast_step.name)
    end
    Specific::Scenario.new(ast_scenario.name, steps)
  end

  feature = Specific::Feature.new(
    ast_feature.name, 
    tags, 
    ast_feature.description,
    scenarios
  )
  @spec.add_feature feature
end