Class: KnapsackPro::Runners::TestUnitRunner

Inherits:
BaseRunner
  • Object
show all
Defined in:
lib/knapsack_pro/runners/test_unit_runner.rb

Class Method Summary collapse

Methods inherited from BaseRunner

#initialize, #stringify_test_file_paths, #test_dir, #test_file_paths, #test_files_to_execute_exist?

Constructor Details

This class inherits a constructor from KnapsackPro::Runners::BaseRunner

Class Method Details

.run(args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/knapsack_pro/runners/test_unit_runner.rb', line 4

def self.run(args)
  ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_test_unit
  ENV['KNAPSACK_PRO_RECORDING_ENABLED'] = 'true'

  adapter_class = KnapsackPro::Adapters::TestUnitAdapter
  KnapsackPro::Config::Env.set_test_runner_adapter(adapter_class)
  runner = new(adapter_class)

  if runner.test_files_to_execute_exist?
    adapter_class.verify_bind_method_called

    KnapsackPro.tracker.set_prerun_tests(runner.test_file_paths)

    cli_args =
      (args || '').split +
      runner.test_file_paths.map do |f|
        File.expand_path(f)
      end

    exit test_unit_autorunner_run(
      true,
      runner.test_dir,
      cli_args
    )
  end
end