Class: Retest::Runners::VariableRunner

Inherits:
Runner
  • Object
show all
Includes:
CachedTestFile
Defined in:
lib/retest/runners/variable_runner.rb

Instance Attribute Summary

Attributes inherited from Runner

#command, #stdout

Instance Method Summary collapse

Methods included from CachedTestFile

#cached_test_file, #cached_test_file=, #purge_test_file

Methods inherited from Runner

#==, #initialize, #run_all_tests

Constructor Details

This class inherits a constructor from Retest::Runners::Runner

Instance Method Details

#run(changed_file, repository:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/retest/runners/variable_runner.rb', line 8

def run(changed_file, repository:)
  self.cached_test_file = repository.find_test(changed_file)

  return print_file_not_found unless cached_test_file

  log(<<~FILES)
    Files Selected:
      - changed: #{changed_file}
      - test: #{cached_test_file}

  FILES

  system_run command
    .gsub('<test>', cached_test_file)
    .gsub('<changed>', changed_file)
end

#sync(added:, removed:) ⇒ Object



25
26
27
# File 'lib/retest/runners/variable_runner.rb', line 25

def sync(added:, removed:)
  purge_test_file(removed)
end