Class: Teabag::Formatters::BaseFormatter
- Inherits:
-
Object
- Object
- Teabag::Formatters::BaseFormatter
- Defined in:
- lib/teabag/formatters/base_formatter.rb
Direct Known Subclasses
DotFormatter, SwayzeOrOprahFormatter, TapFormatter, TapYFormatter
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#failures ⇒ Object
Returns the value of attribute failures.
-
#passes ⇒ Object
Returns the value of attribute passes.
-
#pendings ⇒ Object
Returns the value of attribute pendings.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
-
#exception(exception = {}) ⇒ Object
Exceptions come from startup errors in the server.
-
#initialize(suite_name = :default) ⇒ BaseFormatter
constructor
A new instance of BaseFormatter.
- #result(results) ⇒ Object
- #spec(result) ⇒ Object
- #suppress_logs? ⇒ Boolean
Constructor Details
#initialize(suite_name = :default) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
14 15 16 17 18 19 20 21 |
# File 'lib/teabag/formatters/base_formatter.rb', line 14 def initialize(suite_name = :default) @suite_name = suite_name.to_s @total = 0 @passes = [] @pendings = [] @failures = [] @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
12 13 14 |
# File 'lib/teabag/formatters/base_formatter.rb', line 12 def errors @errors end |
#failures ⇒ Object
Returns the value of attribute failures.
12 13 14 |
# File 'lib/teabag/formatters/base_formatter.rb', line 12 def failures @failures end |
#passes ⇒ Object
Returns the value of attribute passes.
12 13 14 |
# File 'lib/teabag/formatters/base_formatter.rb', line 12 def passes @passes end |
#pendings ⇒ Object
Returns the value of attribute pendings.
12 13 14 |
# File 'lib/teabag/formatters/base_formatter.rb', line 12 def pendings @pendings end |
#total ⇒ Object
Returns the value of attribute total.
12 13 14 |
# File 'lib/teabag/formatters/base_formatter.rb', line 12 def total @total end |
Instance Method Details
#exception(exception = {}) ⇒ Object
Exceptions come from startup errors in the server
42 43 44 |
# File 'lib/teabag/formatters/base_formatter.rb', line 42 def exception(exception = {}) raise Teabag::RunnerException end |
#result(results) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/teabag/formatters/base_formatter.rb', line 34 def result(results) log_coverage(results["coverage"]) return if failures.size == 0 STDOUT.print("\n") raise Teabag::Failure if Teabag.configuration.fail_fast end |
#spec(result) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/teabag/formatters/base_formatter.rb', line 23 def spec(result) @total += 1 if result.passing? @passes << result elsif result.pending? @pendings << result else @failures << result end end |
#suppress_logs? ⇒ Boolean
46 47 48 |
# File 'lib/teabag/formatters/base_formatter.rb', line 46 def suppress_logs? false end |