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.
Instance Method Details
#all ⇒ Array<TestScript>
Return a list of all known test scripts
5 6 7 |
# File 'lib/test-runner/test_script_list.rb', line 5 def all (TestList.new.all) end |
#by_path(path) ⇒ TestScript
Return one test script specified by path
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/test-runner/test_script_list.rb', line 18 def by_path(path) test_path, script_name = path.split('#') test = TestList.new.by_path(test_path) if script_name test.test_scripts.detect { |ts| ts.name == script_name } 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)
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/test-runner/test_script_list.rb', line 34 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
12 13 14 |
# File 'lib/test-runner/test_script_list.rb', line 12 def filter(&) all.select(&) end |