class DeltaTest::RelatedSpecList
Public Class Methods
new()
click to toggle source
# File lib/delta_test/related_spec_list.rb, line 15 def initialize @git = Git.new(DeltaTest.config.base_path) end
Public Instance Methods
customs()
click to toggle source
Custom spec files
@return {Set|Nil}
# File lib/delta_test/related_spec_list.rb, line 89 def customs return nil unless @changed_files return @customs if @customs @customs = Set.new DeltaTest.config.custom_mappings.each do |spec_file, patterns| if Utils.files_grep(@changed_files, patterns).any? @customs << spec_file end end @customs end
dependents()
click to toggle source
Dependent spec files
@return {Set|Nil}
# File lib/delta_test/related_spec_list.rb, line 68 def dependents return nil unless @changed_files && @table return @dependents if @dependents @dependents = Set.new @table.each do |spec_file, dependencies| dependent = @changed_files.include?(spec_file) \ || (dependencies.map(&:to_s) & @changed_files).any? @dependents << spec_file if dependent end @dependents end
full()
click to toggle source
Full spec files
@return {Set|Nil}
# File lib/delta_test/related_spec_list.rb, line 109 def full return nil unless @table @full ||= Set.new(@table.keys) end
full_tests?()
click to toggle source
Return if full tests are related
@return {Boolean}
# File lib/delta_test/related_spec_list.rb, line 49 def full_tests? return false unless @changed_files return @full_tests if defined?(@full_tests) @full_tests = false @full_tests ||= DeltaTest.config.full_test_branches.include?(@git.current_branch) @full_tests ||= DeltaTest.config.full_test_patterns.any? && Utils.files_grep( @changed_files, DeltaTest.config.full_test_patterns ).any? @full_tests end
load_table!(table_file_path)
click to toggle source
Load table from the file
# File lib/delta_test/related_spec_list.rb, line 22 def load_table!(table_file_path) unless File.exist?(table_file_path) raise TableNotFoundError.new(table_file_path) end @table = DependenciesTable.load(table_file_path) end
retrive_changed_files!(commit)
click to toggle source
Retrive changed files in git diff
@params {String} base @params {String} head
# File lib/delta_test/related_spec_list.rb, line 36 def retrive_changed_files!(commit) unless @git.git_repo? raise NotInGitRepositoryError end @changed_files = @git.changed_files(commit) end