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, TeamcityFormatter
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.
15 16 17 18 19 20 21 22 |
# File 'lib/teabag/formatters/base_formatter.rb', line 15 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.
13 14 15 |
# File 'lib/teabag/formatters/base_formatter.rb', line 13 def errors @errors end |
#failures ⇒ Object
Returns the value of attribute failures.
13 14 15 |
# File 'lib/teabag/formatters/base_formatter.rb', line 13 def failures @failures end |
#passes ⇒ Object
Returns the value of attribute passes.
13 14 15 |
# File 'lib/teabag/formatters/base_formatter.rb', line 13 def passes @passes end |
#pendings ⇒ Object
Returns the value of attribute pendings.
13 14 15 |
# File 'lib/teabag/formatters/base_formatter.rb', line 13 def pendings @pendings end |
#total ⇒ Object
Returns the value of attribute total.
13 14 15 |
# File 'lib/teabag/formatters/base_formatter.rb', line 13 def total @total end |
Instance Method Details
#exception(exception = {}) ⇒ Object
Exceptions come from startup errors in the server
43 44 45 |
# File 'lib/teabag/formatters/base_formatter.rb', line 43 def exception(exception = {}) raise Teabag::RunnerException end |
#result(results) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/teabag/formatters/base_formatter.rb', line 35 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
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/teabag/formatters/base_formatter.rb', line 24 def spec(result) @total += 1 if result.passing? @passes << result elsif result.pending? @pendings << result else @failures << result end end |
#suppress_logs? ⇒ Boolean
47 48 49 |
# File 'lib/teabag/formatters/base_formatter.rb', line 47 def suppress_logs? false end |