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.

### Methods

add_example_group close dump_failure dump_pending dump_summary example_failed example_passed example_pending example_started new start start_dump

### Attributes

example_group | [RW] |
options | [RW] |
where | [RW] |

### Public Class methods

new(options, where)

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 7
     7:         def initialize(options, where)
     8:           @options = options
     9:           @where = where
    10:         end

### Public Instance methods

add_example_group(example_group)

This method is invoked at the beginning of the execution of each example_group. `example_group` is the example_group.

The next method to be invoked after this is example_failed or example_finished

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 25
    25:         def add_example_group(example_group)
    26:           @example_group = example_group
    27:         end

close()

This method is invoked at the very end. Allows the formatter to clean up, like closing open streams.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 72
    72:         def close
    73:         end

dump_failure(counter, failure)

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.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 60
    60:         def dump_failure(counter, failure)
    61:         end

dump_pending()

This gets invoked after the summary if option is set to do so.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 68
    68:         def dump_pending
    69:         end

dump_summary(duration, example_count, failure_count, pending_count)

This method is invoked after the dumping of examples and failures.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 64
    64:         def dump_summary(duration, example_count, failure_count, pending_count)
    65:         end

example_failed(example, counter, failure)

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.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 41
    41:         def example_failed(example, counter, failure)
    42:         end

example_passed(example)

This method is invoked when an `example` passes.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 34
    34:         def example_passed(example)
    35:         end

example_pending(example, message)

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. `message` is the message from the ExamplePendingError, if it exists, or the default value of "Not Yet Implemented"

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 48
    48:         def example_pending(example, message)
    49:         end

example_started(example)

This method is invoked when an `example` starts.

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 30
    30:         def example_started(example)
    31:         end

start(example_count)

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_example_group

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 18
    18:         def start(example_count)
    19:         end

start_dump()

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),

[Source]

        # File lib/spec/runner/formatter/base_formatter.rb, line 53
    53:         def start_dump
    54:         end

[Validate]