Module: Guard::Minitest::Inspector

Defined in:
lib/guard/minitest/inspector.rb

Class Method Summary collapse

Class Method Details

.clean(paths) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/guard/minitest/inspector.rb', line 7

def clean(paths)
  paths.uniq!
  paths.compact!
  paths = paths.select { |p| test_file?(p) || test_folder?(p) }

  paths.dup.each do |path|
    if File.directory?(path)
      paths.delete(path)
      %w{test_*.rb *_test.rb *_spec.rb}.each do |file_pattern|
        paths += Dir.glob(File.join(path,'**', file_pattern))
      end
    end
  end

  paths.uniq!
  paths.compact!
  clear_test_files_list
  paths
end