OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Table helper can have first line being a comment
Christophe Bliard4e05da24c126
diff --git a/spec/support/table_helpers/table_parser.rb b/spec/support/table_helpers/table_parser.rbindex 80466f3e45d..4ac10ceee87 100644--- a/spec/support/table_helpers/table_parser.rb+++ b/spec/support/table_helpers/table_parser.rb@@ -31,14 +31,12 @@module TableHelpersclass TableParserdef parse(representation)- headers, *rows = representation.split("\n")- headers = split(headers)- rows = rows.filter_map { |row| parse_row(row, headers) }- work_packages_data = rows.map.with_index do |row, index|+ headers, *rows = representation.split("\n").filter_map { |line| split_line_into_cells(line) }+ work_packages_data = rows.map.with_index do |cells, index|{attributes: {},index:,- row:+ row: headers.zip(cells).to_h}endheaders.each do |header|@@ -50,13 +48,12 @@ module TableHelpersprivate- def parse_row(row, headers)- case row+ def split_line_into_cells(line)+ case linewhen "", /^\s*#/# noopelse- values = split(row)- headers.zip(values).to_h+ split(line)endenddiff --git a/spec/support_spec/table_helpers/table_parser_spec.rb b/spec/support_spec/table_helpers/table_parser_spec.rbindex 12d0b34e2f1..843d500cd13 100644--- a/spec/support_spec/table_helpers/table_parser_spec.rb+++ b/spec/support_spec/table_helpers/table_parser_spec.rb@@ -53,6 +53,7 @@ RSpec.describe TableHelpers::TableParser doit "ignores comments and empty lines" dotable = <<~TABLE+ # this comment is ignored| subject |# this comment and the following empty line are ignored