Class: TestRunner::TestScriptList
- Inherits:
-
Object
- Object
- TestRunner::TestScriptList
- Defined in:
- lib/test-runner/test_script_list.rb
Instance Method Summary collapse
-
#all ⇒ Array<TestScript>
Return a list of all known test scripts.
-
#by_path(path) ⇒ TestScript
Return one test script specified by path.
- #expand_scripts(test_list) ⇒ Object protected
-
#filter {|| ... } ⇒ Array<TestScript>
Filter through all test scripts, return those that the filter matched.
-
#initialize(system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) ⇒ TestScriptList
constructor
A new instance of TestScriptList.
Constructor Details
#initialize(system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) ⇒ TestScriptList
Returns a new instance of TestScriptList.
3 4 5 |
# File 'lib/test-runner/test_script_list.rb', line 3 def initialize(system: NixCli::DEFAULT_SYSTEM, test_config_path: nil) @test_list = TestList.new(system:, test_config_path:) end |
Instance Method Details
#all ⇒ Array<TestScript>
Return a list of all known test scripts
9 10 11 |
# File 'lib/test-runner/test_script_list.rb', line 9 def all (@test_list.all) end |
#by_path(path) ⇒ TestScript
Return one test script specified by path
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/test-runner/test_script_list.rb', line 22 def by_path(path) test_path, script_name = path.split('#') test = @test_list.by_path(test_path) if script_name script = test.test_scripts[script_name] raise "Test #{test_path} does not have script ##{script_name}" if script.nil? script elsif test.test_scripts.length == 1 test.test_scripts.first[1] else raise "Test #{test_path} has scripts #{test.test_scripts.each_key.map { |v| "##{v}" }.join(', ')}, choose one" end end |
#expand_scripts(test_list) ⇒ Object (protected)
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/test-runner/test_script_list.rb', line 41 def (test_list) ret = [] test_list.each do |test| test.test_scripts.each_value do |ts| ret << ts end end ret end |
#filter {|| ... } ⇒ Array<TestScript>
Filter through all test scripts, return those that the filter matched
16 17 18 |
# File 'lib/test-runner/test_script_list.rb', line 16 def filter(&) all.select(&) end |