Module: Test::Unit::Collector
- Included in:
- Dir, ObjectSpace
- Defined in:
- lib/test/unit/collector.rb,
lib/test/unit/collector/dir.rb,
lib/test/unit/collector/objectspace.rb
Defined Under Namespace
Classes: Dir, ObjectSpace
Instance Method Summary
collapse
Instance Method Details
#add_suite(destination, suite) ⇒ Object
17
18
19
20
21
|
# File 'lib/test/unit/collector.rb', line 17
def add_suite(destination, suite)
to_delete = suite.tests.find_all{|t| !include?(t)}
to_delete.each{|t| suite.delete(t)}
destination << suite unless(suite.size == 0)
end
|
#filter=(filters) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/test/unit/collector.rb', line 8
def filter=(filters)
@filters = case(filters)
when Proc
[filters]
when Array
filters
end
end
|
#include?(test) ⇒ Boolean
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/test/unit/collector.rb', line 23
def include?(test)
return true if(@filters.empty?)
@filters.each do |filter|
result = filter[test]
if(result.nil?)
next
elsif(!result)
return false
else
return true
end
end
true
end
|
#initialize ⇒ Object
4
5
6
|
# File 'lib/test/unit/collector.rb', line 4
def initialize
@filters = []
end
|
#sort(suites) ⇒ Object
38
39
40
|
# File 'lib/test/unit/collector.rb', line 38
def sort(suites)
suites.sort_by{|s| s.name}
end
|