Class: Assert::AssertRunner
- Inherits:
-
Object
- Object
- Assert::AssertRunner
- Defined in:
- lib/assert/assert_runner.rb
Constant Summary collapse
- USER_SETTINGS_FILE =
".assert/init.rb"
- LOCAL_SETTINGS_FILE =
".assert.rb"
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #init(test_files, test_dir) ⇒ Object
-
#initialize(config, test_paths, test_options) ⇒ AssertRunner
constructor
A new instance of AssertRunner.
- #run ⇒ Object
Constructor Details
#initialize(config, test_paths, test_options) ⇒ AssertRunner
Returns a new instance of AssertRunner.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/assert/assert_runner.rb', line 11 def initialize(config, test_paths, ) @config = config Assert::CLI.bench('Applying settings') do apply_user_settings apply_local_settings apply_env_settings apply_option_settings() end paths = test_paths.empty? ? [*self.config.test_dir] : test_paths files = lookup_test_files(paths) init(files, path_of(self.config.test_dir, files.first)) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/assert/assert_runner.rb', line 9 def config @config end |
Instance Method Details
#init(test_files, test_dir) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/assert/assert_runner.rb', line 25 def init(test_files, test_dir) # load any test helper file if test_dir && (h = File.join(test_dir, self.config.test_helper)) && File.exists?(h) Assert::CLI.bench('Requiring test helper'){ require h } end if self.config.list $stdout.puts test_files halt end # load the test files runner, suite, view = self.config.runner, self.config.suite, self.config.view runner.before_load(test_files) suite.before_load(test_files) view.before_load(test_files) Assert::CLI.bench("Requiring #{test_files.size} test files") do test_files.each{ |p| require p } end if self.config.debug puts Assert::CLI.debug_msg("Test files:") test_files.each{ |f| puts Assert::CLI.debug_msg(" #{f}") } end runner.after_load suite.after_load view.after_load end |
#run ⇒ Object
53 54 55 |
# File 'lib/assert/assert_runner.rb', line 53 def run self.config.runner.run end |