Class: Uspec::Stats
- Inherits:
-
Object
- Object
- Uspec::Stats
- Defined in:
- lib/uspec/stats.rb
Instance Attribute Summary collapse
-
#failure ⇒ Object
readonly
Returns the value of attribute failure.
-
#pending ⇒ Object
readonly
Returns the value of attribute pending.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Instance Method Summary collapse
- #<<(result) ⇒ Object
- #clear_results! ⇒ Object
-
#initialize ⇒ Stats
constructor
A new instance of Stats.
- #results ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize ⇒ Stats
Returns a new instance of Stats.
3 4 5 |
# File 'lib/uspec/stats.rb', line 3 def initialize clear_results! end |
Instance Attribute Details
#failure ⇒ Object (readonly)
Returns the value of attribute failure.
6 7 8 |
# File 'lib/uspec/stats.rb', line 6 def failure @failure end |
#pending ⇒ Object (readonly)
Returns the value of attribute pending.
6 7 8 |
# File 'lib/uspec/stats.rb', line 6 def pending @pending end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
6 7 8 |
# File 'lib/uspec/stats.rb', line 6 def success @success end |
Instance Method Details
#<<(result) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/uspec/stats.rb', line 8 def << result if result.success? self.success << result elsif result.pending? self.pending << result else self.failure << result end end |
#clear_results! ⇒ Object
18 19 20 21 22 |
# File 'lib/uspec/stats.rb', line 18 def clear_results! @success = Array.new @failure = Array.new @pending = Array.new end |
#results ⇒ Object
24 25 26 |
# File 'lib/uspec/stats.rb', line 24 def results @success + @failure + @pending end |