Sha256: 9129a25c0ed7489c22f117cc5dfc96f2804f3524d84616d489c72a5b8debdc18

Contents?: true

Size: 854 Bytes

Versions: 9

Compression:

Stored size: 854 Bytes

Contents

require_relative "cached_test_file"

module Retest
  module Runners
    class VariableRunner < Runner
      include CachedTestFile

      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

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

      private

      def print_file_not_found
        log(<<~ERROR)
          404 - Test File Not Found
          Retest could not find a matching test file to run.
        ERROR
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
retest-2.0.0.pre3 lib/retest/runners/variable_runner.rb
retest-2.0.0.pre2 lib/retest/runners/variable_runner.rb
retest-2.0.0.pre1 lib/retest/runners/variable_runner.rb
retest-2.0.0.pre lib/retest/runners/variable_runner.rb
retest-1.13.2 lib/retest/runners/variable_runner.rb
retest-1.13.1 lib/retest/runners/variable_runner.rb
retest-1.13.0 lib/retest/runners/variable_runner.rb
retest-1.12.0 lib/retest/runners/variable_runner.rb
retest-1.11.0 lib/retest/runners/variable_runner.rb