class Guard::Test::Inspectors::BaseInspector
Attributes
options[RW]
test_paths[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 8 def initialize(options = {}) @options = options @test_paths = @options[:test_paths] end
Public Instance Methods
failed(locations)
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 17 def failed(locations) raise _abstract end
paths(paths)
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 13 def paths(paths) raise _abstract end
reload()
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 21 def reload raise _abstract end
Private Instance Methods
_abstract()
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 27 def _abstract 'Must be implemented in subclass' end
_check_test_files(path)
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 68 def _check_test_files(path) Dir[File.join(path, '**', 'test_*.rb')] + Dir[File.join(path, '**', '*_test{s,}.rb')] end
_clean(paths)
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 31 def _clean(paths) cleaned_paths = paths.dup paths.each do |path| if _test_folder?(path) cleaned_paths.delete(path) cleaned_paths += _check_test_files(path) else cleaned_paths.delete(path) unless _test_file?(path) end end cleaned_paths.uniq! cleaned_paths.compact! _clear_test_files_list puts "cleaned #{cleaned_paths}" cleaned_paths.sort - ['test/test_helper.rb'] end
_clear_test_files_list()
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 64 def _clear_test_files_list @_test_files = nil end
_test_file?(path)
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 56 def _test_file?(path) _test_files.include?(path) end
_test_files()
click to toggle source
# File lib/guard/test/inspectors/base_inspector.rb, line 60 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/inspectors/base_inspector.rb, line 51 def _test_folder?(path) paths = test_paths.join("|") path.match(%r{^\/?(#{paths})}) && !path.match(/\..+$/) && File.directory?(path) end