lib/cucumber/parser/gherkin_builder.rb in cucumber-0.8.3 vs lib/cucumber/parser/gherkin_builder.rb in cucumber-0.8.4

- old
+ new

@@ -11,57 +11,57 @@ def ast @feature || @multiline_arg end - def feature(comments, tags, keyword, name, description, uri) + def feature(statement, uri) @feature = Ast::Feature.new( nil, - Ast::Comment.new(comments.join("\n")), - Ast::Tags.new(nil, tags), - keyword, - legacy_name_for(name, description), + Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), + Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}), + statement.keyword, + legacy_name_for(statement.name, statement.description), [] ) end - def background(comments, keyword, name, description, line) + def background(statement) @background = Ast::Background.new( - Ast::Comment.new(comments.join("\n")), - line, - keyword, - legacy_name_for(name, description), + Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), + statement.line, + statement.keyword, + legacy_name_for(statement.name, statement.description), steps=[] ) @feature.background = @background @background.feature = @feature @step_container = @background end - def scenario(comments, tags, keyword, name, description, line) + def scenario(statement) scenario = Ast::Scenario.new( @background, - Ast::Comment.new(comments.join("\n")), - Ast::Tags.new(nil, tags), - line, - keyword, - legacy_name_for(name, description), + Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), + Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}), + statement.line, + statement.keyword, + legacy_name_for(statement.name, statement.description), steps=[] ) @feature.add_feature_element(scenario) @background.feature_elements << scenario if @background @step_container = scenario end - def scenario_outline(comments, tags, keyword, name, description, line) + def scenario_outline(statement) scenario_outline = Ast::ScenarioOutline.new( @background, - Ast::Comment.new(comments.join("\n")), - Ast::Tags.new(nil, tags), - line, - keyword, - legacy_name_for(name, description), + Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), + Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}), + statement.line, + statement.keyword, + legacy_name_for(statement.name, statement.description), steps=[], example_sections=[] ) @feature.add_feature_element(scenario_outline) if @background @@ -69,20 +69,26 @@ @background.feature_elements << scenario_outline end @step_container = scenario_outline end - def examples(comments, tags, keyword, name, description, line, examples_table) - examples_fields = [Ast::Comment.new(comments.join("\n")), line, keyword, legacy_name_for(name, description), matrix(examples_table)] + def examples(statement, examples_rows) + examples_fields = [ + Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), + statement.line, + statement.keyword, + legacy_name_for(statement.name, statement.description), + matrix(examples_rows) + ] @step_container.add_examples(examples_fields) end - def step(comments, keyword, name, line, multiline_arg, status, exception, arguments, stepdef_location) - @table_owner = Ast::Step.new(line, keyword, name) + def step(statement, multiline_arg, result) + @table_owner = Ast::Step.new(statement.line, statement.keyword, statement.name) multiline_arg = rubify(multiline_arg) case(multiline_arg) - when String - @table_owner.multiline_arg = Ast::PyString.new(multiline_arg) + when Gherkin::Formatter::Model::PyString + @table_owner.multiline_arg = Ast::PyString.new(multiline_arg.value) when Array @table_owner.multiline_arg = Ast::Table.new(matrix(multiline_arg)) end @step_container.add_step(@table_owner) end