Class: Spec::Runner::Reporter

Class | Spec::Runner::Reporter
In: | lib/spec/runner/reporter.rb
Parent: | Object

### Methods

add_example_group dump end example_failed example_finished example_started failure new start

### Classes and Modules

Class Spec::Runner::Reporter::Failure

### Attributes

example_groups | [R] |
options | [R] |

### Public Class methods

new(options)

[Source]

        # File lib/spec/runner/reporter.rb, line 6
     6:       def initialize(options)
     7:         @options = options
     8:         @options.reporter = self
     9:         clear
    10:       end

### Public Instance methods

add_example_group(example_group)

[Source]

        # File lib/spec/runner/reporter.rb, line 12
    12:       def add_example_group(example_group)
    13:         formatters.each do |f|
    14:           f.add_example_group(example_group)
    15:         end
    16:         example_groups << example_group
    17:       end

dump()

Dumps the summary and returns the total number of failures

[Source]

        # File lib/spec/runner/reporter.rb, line 57
    57:       def dump
    58:         formatters.each{|f| f.start_dump}
    59:         dump_pending
    60:         dump_failures
    61:         formatters.each do |f|
    62:           f.dump_summary(duration, @examples.length, @failures.length, @pending_count)
    63:           f.close
    64:         end
    65:         @failures.length
    66:       end

end()

[Source]

        # File lib/spec/runner/reporter.rb, line 52
    52:       def end
    53:         @end_time = Time.new
    54:       end

example_failed(example, error)

Alias for failure

example_finished(example, error=nil)

[Source]

        # File lib/spec/runner/reporter.rb, line 23
    23:       def example_finished(example, error=nil)
    24:         @examples << example
    25:
    26:         if error.nil?
    27:           example_passed(example)
    28:         elsif Spec::Example::ExamplePendingError === error
    29:           example_pending(example_groups.last, example, error.message)
    30:         else
    31:           example_failed(example, error)
    32:         end
    33:       end

example_started(example)

[Source]

        # File lib/spec/runner/reporter.rb, line 19
    19:       def example_started(example)
    20:         formatters.each{|f| f.example_started(example)}
    21:       end

failure(example, error)

[Source]

        # File lib/spec/runner/reporter.rb, line 35
    35:       def failure(example, error)
    36:         backtrace_tweaker.tweak_backtrace(error)
    37:         example_name = "#{example_groups.last.description} #{example.description}"
    38:         failure = Failure.new(example_name, error)
    39:         @failures << failure
    40:         formatters.each do |f|
    41:           f.example_failed(example, @failures.length, failure)
    42:         end
    43:       end

start(number_of_examples)

[Source]

        # File lib/spec/runner/reporter.rb, line 46
    46:       def start(number_of_examples)
    47:         clear
    48:         @start_time = Time.new
    49:         formatters.each{|f| f.start(number_of_examples)}
    50:       end

[Validate]