Module: Testdiff::Modified::Specs

Defined in:
lib/testdiff/modified/specs.rb

Overview

Finds all modified Rspec files

Class Method Summary collapse

Class Method Details

.associatedObject



20
21
22
23
24
25
26
# File 'lib/testdiff/modified/specs.rb', line 20

def associated
  files.map do |file|
    file.gsub('.rb', '_spec.rb')
        .gsub('app/', 'spec/')
        .gsub('lib/', 'spec/lib/')
  end
end

.filesObject



28
29
30
# File 'lib/testdiff/modified/specs.rb', line 28

def files
  Testdiff::Modified::RubyFiles.find
end

.findObject



9
10
11
12
# File 'lib/testdiff/modified/specs.rb', line 9

def find
  modified.concat(associated)
          .select { |file| File.exist?(file) }
end

.modifiedObject

private



16
17
18
# File 'lib/testdiff/modified/specs.rb', line 16

def modified
  files.select { |file| file.include?('_spec.rb') }
end