module TableStepsHelper

Public Instance Methods

parse_table(table) click to toggle source
# File lib/spreewald/table_steps.rb, line 103
def parse_table(table)
  if table.is_a?(String)
    # multiline string. split it assuming a format like cucumber tables have.
    table.split(/\n/).collect do |line|
      line.sub!(/^\|/, '')
      line.sub!(/\|$/, '')
      line.split(/\s*\|\s*/)
    end
  else
    # vanilla cucumber table.
    table.raw
  end
end