features/env.rb in terrestrial-0.3.0 vs features/env.rb in terrestrial-0.5.0

- old
+ new

@@ -26,20 +26,30 @@ def normalise_inspection_string(string) string .strip .gsub(/[\n\s]+/, " ") .gsub(/ \>/, ">") - .gsub(/\:0x[0-9a-f]{14}/, ":<<object id removed>>") + .gsub(/\:0x[0-9a-f]{14,}/, ":<<object id removed>>") end def parse_schema_table(string) string.each_line.drop(2).map { |line| - name, type = line.split("|").map(&:strip) + name, type, options = line.split("|").map(&:strip) + { name: name, type: Object.const_get(type), + options: string_to_schema_options(options.to_s), } } + end + + def string_to_schema_options(string) + Hash[ + string.split(",").map(&:strip).reject(&:empty?).map { |s| + [s.downcase.gsub(" ", "_").to_sym, true] + } + ] end end module DatabaseSupport def create_table(name, columns)