Class: Spec::Runner::Formatter::BaseFormatter
- Defined in:
- lib/spec/runner/formatter/base_formatter.rb
Overview
Baseclass for formatters that implements all required methods as no-ops.
Direct Known Subclasses
Instance Method Summary collapse
-
#add_behaviour(name) ⇒ Object
This method is invoked at the beginning of the execution of each behaviour.
-
#close ⇒ Object
This method is invoked at the very end.
-
#dump_failure(counter, failure) ⇒ Object
Dumps detailed information about an example failure.
-
#dump_pending ⇒ Object
This gets invoked after the summary if option is set to do so.
-
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
This method is invoked after the dumping of examples and failures.
-
#example_failed(example, counter, failure) ⇒ Object
This method is invoked when an
example
fails, i.e. -
#example_passed(example) ⇒ Object
This method is invoked when an
example
passes. -
#example_pending(behaviour_name, example_name, message) ⇒ Object
This method is invoked when an example is not yet implemented (i.e. has not been provided a block), or when an ExamplePendingError is raised.
-
#example_started(example) ⇒ Object
This method is invoked when an
example
starts. -
#initialize(where) ⇒ BaseFormatter
constructor
A new instance of BaseFormatter.
-
#start(example_count) ⇒ Object
This method is invoked before any examples are run, right after they have all been collected.
-
#start_dump ⇒ Object
This method is invoked after all of the examples have executed.
Constructor Details
#initialize(where) ⇒ BaseFormatter
Returns a new instance of BaseFormatter.
6 7 8 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 6 def initialize(where) @where = where end |
Instance Method Details
#add_behaviour(name) ⇒ Object
This method is invoked at the beginning of the execution of each behaviour. name
is the name of the behaviour and first
is true if it is the first behaviour - otherwise it’s false.
The next method to be invoked after this is #example_failed or #example_finished
24 25 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 24 def add_behaviour(name) end |
#close ⇒ Object
This method is invoked at the very end. Allows the formatter to clean up, like closing open streams.
71 72 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 71 def close end |
#dump_failure(counter, failure) ⇒ Object
Dumps detailed information about an example failure. This method is invoked for each failed example after all examples have run. counter
is the sequence number of the associated example. failure
is a Failure object, which contains detailed information about the failure.
59 60 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 59 def dump_failure(counter, failure) end |
#dump_pending ⇒ Object
This gets invoked after the summary if option is set to do so.
67 68 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 67 def dump_pending end |
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
This method is invoked after the dumping of examples and failures.
63 64 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 63 def dump_summary(duration, example_count, failure_count, pending_count) end |
#example_failed(example, counter, failure) ⇒ Object
This method is invoked when an example
fails, i.e. an exception occurred inside it (such as a failed should or other exception). counter
is the sequence number of the failure (starting at 1) and failure
is the associated Failure object.
39 40 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 39 def example_failed(example, counter, failure) end |
#example_passed(example) ⇒ Object
This method is invoked when an example
passes.
32 33 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 32 def example_passed(example) end |
#example_pending(behaviour_name, example_name, message) ⇒ Object
This method is invoked when an example is not yet implemented (i.e. has not been provided a block), or when an ExamplePendingError is raised. name
is the name of the example. message
is the message from the ExamplePendingError, if it exists, or the default value of “Not Yet Implemented”
47 48 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 47 def example_pending(behaviour_name, example_name, ) end |
#example_started(example) ⇒ Object
This method is invoked when an example
starts.
28 29 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 28 def example_started(example) end |
#start(example_count) ⇒ Object
This method is invoked before any examples are run, right after they have all been collected. This can be useful for special formatters that need to provide progress on feedback (graphical ones)
This method will only be invoked once, and the next one to be invoked is #add_behaviour
16 17 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 16 def start(example_count) end |
#start_dump ⇒ Object
This method is invoked after all of the examples have executed. The next method to be invoked after this one is #dump_failure (once for each failed example),
52 53 |
# File 'lib/spec/runner/formatter/base_formatter.rb', line 52 def start_dump end |