Module: Tet::Stats
- Defined in:
- lib/tet.rb
Overview
Tracks and reports statistics about the tests that have run
Constant Summary collapse
- Counts =
{ passed: 0, failed: 0, erred: 0 }
- Marks =
{ passed: ?., failed: ?!, erred: ?? }
Class Method Summary collapse
-
.empty? ⇒ Boolean
Returns true if no statistics have been logged.
-
.erred ⇒ Object
Call when an assertion has erred.
-
.failed ⇒ Object
Call when an assertion has failed.
-
.passed ⇒ Object
Call when an assertion has passed.
-
.report ⇒ Object
Returns a string with statistics about the tests that have been run.
Class Method Details
.empty? ⇒ Boolean
Returns true if no statistics have been logged
176 177 178 |
# File 'lib/tet.rb', line 176 def empty? Counts.values.inject(&:+).zero? end |
.erred ⇒ Object
Call when an assertion has erred
171 172 173 |
# File 'lib/tet.rb', line 171 def erred log :erred end |
.failed ⇒ Object
Call when an assertion has failed
166 167 168 |
# File 'lib/tet.rb', line 166 def failed log :failed end |
.passed ⇒ Object
Call when an assertion has passed
161 162 163 |
# File 'lib/tet.rb', line 161 def passed log :passed end |
.report ⇒ Object
Returns a string with statistics about the tests that have been run
181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/tet.rb', line 181 def report errors = Counts[:erred] fails = Counts[:failed] passes = Counts[:passed] output = [] output << "Errors: #{errors}" unless errors.zero? output << "Failed: #{fails}" output << "Passed: #{passes}" output.join(?\n) end |