module Guard::Test::Inspector

Public Class Methods

clean(paths) click to toggle source
# File lib/guard/test/inspector.rb, line 16
def clean(paths)
  paths.uniq!
  paths.compact!

  paths.dup.each do |path|
    if test_folder?(path)
      paths.delete(path)
      paths += check_test_files(path)
    else
      paths.delete(path) unless test_file?(path)
    end
  end

  paths.uniq!
  paths.compact!
  clear_test_files_list
  paths.sort - ['test/test_helper.rb']
end
test_paths() click to toggle source
# File lib/guard/test/inspector.rb, line 8
def test_paths
  @test_paths || []
end
test_paths=(path_array) click to toggle source
# File lib/guard/test/inspector.rb, line 12
def test_paths=(path_array)
  @test_paths = Array(path_array)
end

Private Class Methods

check_test_files(path) click to toggle source
# File lib/guard/test/inspector.rb, line 54
def check_test_files(path)
  Dir[File.join(path, '**', 'test_*.rb')] +
  Dir[File.join(path, '**', '*_test{s,}.rb')]
end
clear_test_files_list() click to toggle source
# File lib/guard/test/inspector.rb, line 50
def clear_test_files_list
  @test_files = nil
end
test_file?(path) click to toggle source
# File lib/guard/test/inspector.rb, line 42
def test_file?(path)
  test_files.include?(path)
end
test_files() click to toggle source
# File lib/guard/test/inspector.rb, line 46
def test_files
  @test_files ||= test_paths.collect { |path| check_test_files(path) }.flatten
end
test_folder?(path) click to toggle source
# File lib/guard/test/inspector.rb, line 37
def test_folder?(path)
  paths = test_paths.join("|")
  path.match(%r{^\/?(#{paths})}) && !path.match(/\..+$/) && File.directory?(path)
end