lib/retest/repository.rb in retest-0.4.0 vs lib/retest/repository.rb in retest-0.4.1

- old
+ new

@@ -8,11 +8,11 @@ @input_stream = input_stream || STDIN @output_stream = output_stream|| STDOUT end def find_test(path) - cache[path] ||= select_from test_options(path) + cache[path] ||= select_from TestOptions.for(path, files: files) end private def select_from(tests) @@ -23,30 +23,11 @@ ask_question tests tests[get_input] end end - def test_options(path) - return [path] if is_test_file?(path) - - files.select { |file| regex(path) =~ file } - .sort_by { |file| String::Similarity.levenshtein(path, file) } - .last(5) - .reverse - end - def default_files @default_files ||= Dir.glob('**/*') - Dir.glob('{tmp,node_modules}/**/*') - end - - def is_test_file?(path) - Regexp.new(".*(?:spec|test)#{File.extname(path)}") =~ path - end - - def regex(path) - extname = File.extname(path) - basename = File.basename(path, extname) - Regexp.new(".*#{basename}_(?:spec|test)#{extname}") end def ask_question(tests) output_stream.puts <<~QUESTION We found few tests matching: \ No newline at end of file