module Maxitest::Testrbl

def pattern_from_file(lines, line)

usable via external tools like zeus
def pattern_from_file(lines, line)
  possible_lines = lines[0..(line.to_i-1)].reverse
  found = possible_lines.map { |line| test_pattern_from_line(line) || block_start_from_line(line) }.compact
  # pattern and the groups it is nested under (like describe - describe - it)
  last_spaces = " " * 100
  patterns = found.select do |spaces, name|
    last_spaces = spaces if spaces.size < last_spaces.size
  end.map(&:last).compact
  return filter_duplicate_final(patterns).reverse.join(".*") if found.size > 0
  raise "no test found before line #{line}"
end