Class: TestRunner::TestScriptList

Inherits:
Object
  • Object
show all
Defined in:
lib/test-runner/test_script_list.rb

Instance Method Summary collapse

Instance Method Details

#allArray<TestScript>

Return a list of all known test scripts

Returns:



5
6
7
# File 'lib/test-runner/test_script_list.rb', line 5

def all
  expand_scripts(TestList.new.all)
end

#by_path(path) ⇒ TestScript

Return one test script specified by path

Returns:



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 expand_scripts(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

Yield Parameters:

Returns:



12
13
14
# File 'lib/test-runner/test_script_list.rb', line 12

def filter(&)
  all.select(&)
end