Class: Guard::SporkMinitest::Inspector

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/sporkminitest/inspector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_folders, test_file_patterns) ⇒ Inspector

Returns a new instance of Inspector.



8
9
10
11
# File 'lib/guard/sporkminitest/inspector.rb', line 8

def initialize(test_folders, test_file_patterns)
  @test_folders = test_folders.uniq.compact.freeze
  @test_file_patterns = test_file_patterns.uniq.compact.freeze
end

Instance Attribute Details

#test_file_patternsObject (readonly)

Returns the value of attribute test_file_patterns.



6
7
8
# File 'lib/guard/sporkminitest/inspector.rb', line 6

def test_file_patterns
  @test_file_patterns
end

#test_foldersObject (readonly)

Returns the value of attribute test_folders.



6
7
8
# File 'lib/guard/sporkminitest/inspector.rb', line 6

def test_folders
  @test_folders
end

Instance Method Details

#clean(paths) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/guard/sporkminitest/inspector.rb', line 17

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

  paths.dup.each do |path|
    if File.directory?(path)
      paths.delete(path)
      paths += test_files_for_paths([path])
    end
  end

  paths.uniq!
  paths.compact!
  clear_test_files_list
  paths
end

#clean_allObject



13
14
15
# File 'lib/guard/sporkminitest/inspector.rb', line 13

def clean_all
  clean self.test_folders
end