Class: ManiokBdd::GherkinFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/maniok_bdd/gherkin_formatter.rb

Defined Under Namespace

Classes: Feature, GherkinCollection, Scenario, Step

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(feature_file) ⇒ Object



5
6
7
8
9
10
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 5

def self.build(feature_file)
  new.tap do |gherkin_formatter|
    parser = Gherkin::Parser::Parser.new(gherkin_formatter, true)
    parser.parse(File.read(feature_file), feature_file, 0)
  end
end

Instance Method Details

#eofObject



32
33
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 32

def eof
end

#feature(gherkin_model_feature) ⇒ Object



16
17
18
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 16

def feature(gherkin_model_feature)
  @feature = Feature.new gherkin_model_feature
end

#scenario(gherkin_model_scenario) ⇒ Object



20
21
22
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 20

def scenario(gherkin_model_scenario)
  @feature.scenarios << (@current_scenario = Scenario.new(gherkin_model_scenario))
end

#step(gherkin_model_step) ⇒ Object



24
25
26
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 24

def step(gherkin_model_step)
  @current_scenario.steps << Step.new(gherkin_model_step)
end

#to_sObject



12
13
14
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 12

def to_s
  @feature.to_s
end

#uriObject

to avoid undefined method ‘uri’ & efo and keep Gherkin parser happy



29
30
# File 'lib/maniok_bdd/gherkin_formatter.rb', line 29

def uri(*)
end