Class: Test::Unit::UI::Statistics::SuiteStatistics
- Inherits:
-
Object
- Object
- Test::Unit::UI::Statistics::SuiteStatistics
- Defined in:
- lib/test/unit/ui/statistics.rb
Instance Attribute Summary collapse
-
#forward_class ⇒ Object
Returns the value of attribute forward_class.
-
#test_suite ⇒ Object
readonly
Returns the value of attribute test_suite.
Instance Method Summary collapse
- #add_test_case_statistics(stats) ⇒ Object
- #aggregate(sym) ⇒ Object
-
#initialize(test_suite) ⇒ SuiteStatistics
constructor
A new instance of SuiteStatistics.
- #method_missing(sym, *args) ⇒ Object
- #respond_to?(sym) ⇒ Boolean
Constructor Details
#initialize(test_suite) ⇒ SuiteStatistics
Returns a new instance of SuiteStatistics.
39 40 41 42 |
# File 'lib/test/unit/ui/statistics.rb', line 39 def initialize test_suite @test_suite = test_suite @aggregate_statistics = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/test/unit/ui/statistics.rb', line 52 def method_missing sym, *args if respond_to?(sym) aggregate(sym) else super end end |
Instance Attribute Details
#forward_class ⇒ Object
Returns the value of attribute forward_class.
37 38 39 |
# File 'lib/test/unit/ui/statistics.rb', line 37 def forward_class @forward_class end |
#test_suite ⇒ Object (readonly)
Returns the value of attribute test_suite.
36 37 38 |
# File 'lib/test/unit/ui/statistics.rb', line 36 def test_suite @test_suite end |
Instance Method Details
#add_test_case_statistics(stats) ⇒ Object
44 45 46 |
# File 'lib/test/unit/ui/statistics.rb', line 44 def add_test_case_statistics stats @aggregate_statistics << stats end |
#aggregate(sym) ⇒ Object
48 49 50 |
# File 'lib/test/unit/ui/statistics.rb', line 48 def aggregate sym @aggregate_statistics.inject(0) {|a,v| a + v.send(sym) } end |
#respond_to?(sym) ⇒ Boolean
60 61 62 63 |
# File 'lib/test/unit/ui/statistics.rb', line 60 def respond_to? sym Test::Unit::TestResult.instance_methods.include?(sym) or CaseStatistics.instance_methods.include?(sym) end |