Sha256: 5f8d5b10b04a380336223d9382c1a9a2a9ee0975188ea68564a049961942e9b6
Contents?: true
Size: 884 Bytes
Versions: 18
Compression:
Stored size: 884 Bytes
Contents
if $tork_test_file.start_with? 'test/' and $tork_line_numbers.any? test_file_lines = File.readlines($tork_test_file) test_names = $tork_line_numbers.map do |line| catch :found do # search backwards from the desired line number to # the first line in the file for test definitions line.downto(0) do |i| test_name = case test_file_lines[i] when /^\s*def\s+test_(\w+)/ then $1 when /^\s*(test|context|should|describe|it)\b.+?(['"])(.*?)\2/ # elide string interpolation and invalid method name characters $3.gsub(/\#\{.*?\}/, ' ').strip.gsub(/\W+/, '.*') end \ and throw :found, test_name end; nil # prevent unsuccessful search from returning an integer end end.compact.uniq unless test_names.empty? ARGV.push '--name', "/(?i:#{test_names.join('|')})/" end end
Version data entries
18 entries across 18 versions & 1 rubygems