Class: Scrab::FeatureParser::GherkinFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/scrab/feature_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(story) ⇒ GherkinFormatter

Returns a new instance of GherkinFormatter.



9
10
11
# File 'lib/scrab/feature_parser.rb', line 9

def initialize(story)
  @story = story
end

Instance Method Details

#background(background) ⇒ Object



24
25
# File 'lib/scrab/feature_parser.rb', line 24

def background(background)
end

#eofObject



51
52
53
# File 'lib/scrab/feature_parser.rb', line 51

def eof
  # no-op
end

#examples(examples) ⇒ Object



44
45
# File 'lib/scrab/feature_parser.rb', line 44

def examples(examples)
end

#feature(feature) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/scrab/feature_parser.rb', line 13

def feature(feature)
  if feature.name.strip =~ /^\[(US\d+)\]\s+(.*)$/
    @story.id   = $1
    @story.name = $2
  else
    raise ParsingError.new(feature.name, "expect feature title to be in '[US0000] Story name' format")
  end

  @story.narrative = feature.description
end

#scenario(scenario) ⇒ Object



27
28
29
30
31
32
# File 'lib/scrab/feature_parser.rb', line 27

def scenario(scenario)
  @scenario  = Scrab::Scenario.new
  @scenario.name = scenario.name
  @scenario.description = scenario.description
  @story.scenarios << @scenario
end

#scenario_outline(outline) ⇒ Object



41
42
# File 'lib/scrab/feature_parser.rb', line 41

def scenario_outline(outline)
end

#step(step) ⇒ Object



34
35
36
37
38
39
# File 'lib/scrab/feature_parser.rb', line 34

def step(step)
  @step = Scrab::Step.new
  @step.keyword = step.keyword
  @step.name    = step.name
  @scenario.steps << @step
end

#uri(uri) ⇒ Object



47
48
49
# File 'lib/scrab/feature_parser.rb', line 47

def uri(uri)
  # no-op
end