Class: SixthSense::ChangedFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/sixth_sense/changed_files.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(diff_ref) ⇒ ChangedFiles

Returns a new instance of ChangedFiles.



11
12
13
# File 'lib/sixth_sense/changed_files.rb', line 11

def initialize(diff_ref)
  @diff_ref = diff_ref
end

Class Method Details

.test_files(diff_ref) ⇒ Object



7
8
9
# File 'lib/sixth_sense/changed_files.rb', line 7

def self.test_files(diff_ref)
  new(diff_ref).test_files
end

Instance Method Details

#test_filesObject



15
16
17
18
19
20
# File 'lib/sixth_sense/changed_files.rb', line 15

def test_files
  names = changed_names
  specs = names.select { |path| path.end_with?("_spec.rb") && File.file?(path) }
  inferred_specs = names.flat_map { |path| infer_spec_paths(path) }
  (specs + inferred_specs).uniq.sort
end