Class | Spec::Runner::Formatter::BaseFormatter |
In: |
lib/spec/runner/formatter/base_formatter.rb
|
Parent: | Object |
Baseclass for formatters that implements all required methods as no-ops.
# File lib/spec/runner/formatter/base_formatter.rb, line 6 6: def initialize(where) 7: @where = where 8: end
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
# File lib/spec/runner/formatter/base_formatter.rb, line 24 24: def add_behaviour(name) 25: end
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.
# File lib/spec/runner/formatter/base_formatter.rb, line 58 58: def dump_failure(counter, failure) 59: end
This method is invoked at the very end.
# File lib/spec/runner/formatter/base_formatter.rb, line 62 62: def dump_summary(duration, example_count, failure_count, not_implemented_count) 63: end
This method is invoked when an example fails, i.e. an exception occurred inside it (such as a failed should or other exception). name is the name of the example. counter is the sequence number of the failure (starting at 1) and failure is the associated Failure object.
# File lib/spec/runner/formatter/base_formatter.rb, line 41 41: def example_failed(name, counter, failure) 42: end
This method is invoked when an example is not yet implemented (i.e. has not been provided a block). name is the name of the example.
# File lib/spec/runner/formatter/base_formatter.rb, line 46 46: def example_not_implemented(name) 47: end
This method is invoked when an example passes. name is the name of the example.
# File lib/spec/runner/formatter/base_formatter.rb, line 34 34: def example_passed(name) 35: end
This method is invoked when an example starts. name is the name of the example.
# File lib/spec/runner/formatter/base_formatter.rb, line 29 29: def example_started(name) 30: end
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
# File lib/spec/runner/formatter/base_formatter.rb, line 16 16: def start(example_count) 17: end
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),
# File lib/spec/runner/formatter/base_formatter.rb, line 51 51: def start_dump 52: end