Module: TableStepsHelper

Defined in:
lib/spreewald/table_steps.rb

Defined Under Namespace

Modules: ArrayMethods

Instance Method Summary collapse

Instance Method Details

#parse_table(table) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
# 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