Class: Tst::Results
- Inherits:
-
Object
- Object
- Tst::Results
- Defined in:
- lib/tst.rb
Overview
A collection class that keeps track of test results.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#elapsed ⇒ Object
readonly
Returns the value of attribute elapsed.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#<<(result) ⇒ Object
Collects a test result.
- #exceptions ⇒ Object
- #failures ⇒ Object
-
#initialize ⇒ Results
constructor
A new instance of Results.
-
#successes ⇒ Object
Accessors to pull out the subset of tests you need.
Constructor Details
#initialize ⇒ Results
Returns a new instance of Results.
58 59 60 61 62 |
# File 'lib/tst.rb', line 58 def initialize @count = 0 @elapsed = 0 @results = [] end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
56 57 58 |
# File 'lib/tst.rb', line 56 def count @count end |
#elapsed ⇒ Object (readonly)
Returns the value of attribute elapsed.
56 57 58 |
# File 'lib/tst.rb', line 56 def elapsed @elapsed end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
56 57 58 |
# File 'lib/tst.rb', line 56 def results @results end |
Instance Method Details
#<<(result) ⇒ Object
Collects a test result.
65 66 67 68 69 |
# File 'lib/tst.rb', line 65 def <<(result) @count += 1 @elapsed += result.elapsed results << result end |
#exceptions ⇒ Object
74 |
# File 'lib/tst.rb', line 74 def exceptions; results.select { |r| r.status == RAISED } end |
#failures ⇒ Object
73 |
# File 'lib/tst.rb', line 73 def failures; results.select { |r| r.status == FAILED } end |
#successes ⇒ Object
Accessors to pull out the subset of tests you need.
72 |
# File 'lib/tst.rb', line 72 def successes; results.select { |r| r.status == SUCCEEDED } end |