There is no value you can put in a cucumber table that is interpreted as nil
by default. You can use a cucumber Transform to do what you want. For example, you could use it like this if you wanted to interpret an empty string as nil
:
Transform /^table:company_name,phone$/ do |table|
table.hashes.map! do |h|
h.each_pair do |k,v|
h[k] = nil if v == '' #here, you can map any value you want to be nil
end
end
table
end
Put this in a file in your support folder. There are also other methods like map_column!
etc you can use if you want to transform just one column.