Class: Ace::TestRunner::Formatters::BaseFormatter
- Inherits:
-
Object
- Object
- Ace::TestRunner::Formatters::BaseFormatter
- Defined in:
- lib/ace/test_runner/formatters/base_formatter.rb
Overview
Base class for all formatters
Direct Known Subclasses
JsonFormatter, MarkdownFormatter, ProgressFileFormatter, ProgressFormatter
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#report_path ⇒ Object
Returns the value of attribute report_path.
Instance Method Summary collapse
-
#format_report(report) ⇒ Object
Format the complete report for saving.
-
#format_stdout(result) ⇒ Object
Format the test result for stdout output.
-
#initialize(options = {}) ⇒ BaseFormatter
constructor
A new instance of BaseFormatter.
-
#on_finish(result) ⇒ Object
Called when all tests complete.
-
#on_start(total_files) ⇒ Object
Called when test execution starts.
-
#on_test_complete(file, success, duration) ⇒ Object
Called when a single test file completes.
Constructor Details
#initialize(options = {}) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
11 12 13 14 15 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 11 def initialize( = {}) @options = @use_color = .fetch(:color, true) && $stdout.tty? @report_path = nil end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 8 def @options end |
#report_path ⇒ Object
Returns the value of attribute report_path.
9 10 11 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 9 def report_path @report_path end |
Instance Method Details
#format_report(report) ⇒ Object
Format the complete report for saving
23 24 25 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 23 def format_report(report) raise NotImplementedError, "Subclasses must implement format_report" end |
#format_stdout(result) ⇒ Object
Format the test result for stdout output
18 19 20 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 18 def format_stdout(result) raise NotImplementedError, "Subclasses must implement format_stdout" end |
#on_finish(result) ⇒ Object
Called when all tests complete
38 39 40 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 38 def on_finish(result) # Override in subclasses if needed end |
#on_start(total_files) ⇒ Object
Called when test execution starts
28 29 30 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 28 def on_start(total_files) # Override in subclasses if needed end |
#on_test_complete(file, success, duration) ⇒ Object
Called when a single test file completes
33 34 35 |
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 33 def on_test_complete(file, success, duration) # Override in subclasses if needed end |