Class: Spec::Runner::Formatter::BaseFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb

Overview

Baseclass for formatters that implements all required methods as no-ops.

Direct Known Subclasses

BaseTextFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, where) ⇒ BaseFormatter

Returns a new instance of BaseFormatter.



7
8
9
10
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 7

def initialize(options, where)
  @options = options
  @where = where
end

Instance Attribute Details

#example_groupObject

Returns the value of attribute example_group.



6
7
8
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 6

def example_group
  @example_group
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 6

def options
  @options
end

#whereObject

Returns the value of attribute where.



6
7
8
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 6

def where
  @where
end

Instance Method Details

#add_example_group(example_group) ⇒ Object

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



25
26
27
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 25

def add_example_group(example_group)
  @example_group = example_group
end

#closeObject

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



74
75
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 74

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.



62
63
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 62

def dump_failure(counter, failure)
end

#dump_pendingObject

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



70
71
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 70

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.



66
67
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 66

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.



41
42
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 41

def example_failed(example, counter, failure)
end

#example_passed(example) ⇒ Object

This method is invoked when an example passes.



34
35
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 34

def example_passed(example)
end

#example_pending(example, message, pending_caller) ⇒ 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. message is the message from the ExamplePendingError, if it exists, or the default value of “Not Yet Implemented” pending_caller is the file and line number of the spec which has called the pending method



50
51
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 50

def example_pending(example, message, pending_caller)
end

#example_started(example) ⇒ Object

This method is invoked when an example starts.



30
31
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 30

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_example_group



18
19
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 18

def start(example_count)
end

#start_dumpObject

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



55
56
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb', line 55

def start_dump
end