class Guard::MinitestCr::Inspector
Attributes
test_file_patterns[R]
test_folders[R]
test_helpers[R]
Public Class Methods
new(test_folders, test_file_patterns, test_helpers)
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 8 def initialize(test_folders, test_file_patterns, test_helpers) @test_folders = test_folders.uniq.compact @test_file_patterns = test_file_patterns.uniq.compact @test_helpers = test_helpers.uniq.compact end
Public Instance Methods
all_test_files()
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 33 def all_test_files @all_test_files ||= _test_files_for_paths end
clean(paths)
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 18 def clean(paths) paths.reduce([]) do |memo, path| if File.directory?(path) memo += _test_files_for_paths(path) else memo << path if _test_file?(path) end memo end.uniq end
clean_all()
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 14 def clean_all clean(test_folders) end
clear_memoized_test_files()
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 29 def clear_memoized_test_files @all_test_files = nil end
Private Instance Methods
_join_for_glob(fragments)
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 52 def _join_for_glob(fragments) "{#{fragments.join(',')}}" end
_test_file?(path)
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 47 def _test_file?(path) _test_files_for_paths.map {|path| File.expand_path(path) } .include?(File.expand_path(path)) end
_test_files_for_paths(paths = test_folders)
click to toggle source
# File lib/guard/minitestcr/inspector.rb, line 39 def _test_files_for_paths(paths = test_folders) paths = _join_for_glob(Array(paths)) files = _join_for_glob(test_file_patterns) helpers = _join_for_glob(test_helpers) Dir["#{paths}/**/#{files}"] - Dir["#{paths}/**/#{helpers}"] end