Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix some failing tests #131

  • Loading branch information...
commit bfdb7a3c5a37c5aeee193d63c194d0d4faddf209 1 parent 6c4e83a
@mattwynne mattwynne authored
View
18 lib/gherkin/formatter/model.rb
@@ -120,7 +120,11 @@ def row(comments, cells, line)
end
def replay(formatter)
- Examples.new(*(@args << @rows)).replay(formatter)
+ build.replay(formatter)
+ end
+
+ def build
+ Examples.new(*(@args << @rows))
end
end
end
@@ -174,7 +178,11 @@ def doc_string(string, content_type, line)
end
def replay(formatter)
- Step.new(*(@args << @rows << @doc_string)).replay(formatter)
+ build.replay(formatter)
+ end
+
+ def build
+ Step.new(*(@args << @rows << @doc_string))
end
end
end
@@ -210,10 +218,10 @@ def hash
class DocString < Hashable
native_impl('gherkin')
- attr_reader :content_type, :value, :line
+ attr_reader :value, :content_type, :line
- def initialize(content_type, value, line)
- @content_type, @value, @line = content_type, value, line
+ def initialize(value, content_type, line)
+ @value, @content_type, @line = value, content_type, line
end
def line_range
View
2  lib/gherkin/formatter/pretty_formatter.rb
@@ -177,7 +177,7 @@ def table(rows)
private
- def doc_string(doc_string)
+ def doc_string(doc_string)
@io.puts " \"\"\"" + doc_string.content_type + "\n" + escape_triple_quotes(indent(doc_string.value, ' ')) + "\n \"\"\""
end
View
14 lib/gherkin/json_parser.rb
@@ -51,16 +51,18 @@ def feature_element(o)
end
def step(o)
- step = Formatter::Model::Step.new(comments(o), keyword(o), name(o), line(o))
+ builder = Formatter::Model::Step::Builder.new(comments(o), keyword(o), name(o), line(o))
- if(o['rows'])
- step.rows = rows(o['rows'])
- elsif(o['doc_string'])
+ (o['rows'] || []).each do |row|
+ builder.row comments(row), row['cells'], row['line']
+ end
+
+ if(o['doc_string'])
ds = o['doc_string']
- step.doc_string = Formatter::Model::DocString.new(ds['content_type'].to_s, ds['value'], ds['line'])
+ builder.doc_string ds['value'], ds['content_type'].to_s, ds['line']
end
- step
+ builder.build
end
def match(o)
View
4 lib/gherkin/listener/formatter_listener.rb
@@ -68,8 +68,8 @@ def row(cells, line)
end
end
- def doc_string(string, content_type, line)
- @current_builder.doc_string(string, content_type, line)
+ def doc_string(content_type, value, line)
+ @current_builder.doc_string(value, content_type, line)
end
def eof
Please sign in to comment.
Something went wrong with that request. Please try again.