Class Spec::Runner::Reporter

  1. lib/spec/runner/reporter.rb
Parent: Object

Classes and Modules

Class Spec::Runner::Reporter::Failure

Constants

EXAMPLE_PENDING_DEPRECATION_WARNING = <<-WARNING ********************************************************************* DEPRECATION WARNING: RSpec's formatters have changed example_pending to accept two arguments instead of three. Please see the rdoc for Spec::Runner::Formatter::BaseFormatter#example_pending for more information. Please update any custom formatters to accept only two arguments to example_pending. Support for example_pending with two arguments and this warning message will be removed after the RSpec 2.0 release. ********************************************************************* WARNING

Attributes

options [R]

Public class methods

new (options)
[show source]
# File lib/spec/runner/reporter.rb, line 6
      def initialize(options)
        @options = options
        @options.reporter = self
        @failures = []
        @pending_count = 0
        @example_count = 0
        @start_time = nil
        @end_time = nil
      end

Public instance methods

dump ()

Dumps the summary and returns the total number of failures

[show source]
# File lib/spec/runner/reporter.rb, line 58
      def dump
        formatters.each{|f| f.start_dump}
        dump_pending
        dump_failures
        formatters.each do |f|
          f.dump_summary(duration, @example_count, @failures.length, @pending_count)
          f.close
        end
        @failures.length
      end
end ()
[show source]
# File lib/spec/runner/reporter.rb, line 53
      def end
        @end_time = Time.new
      end
example_failed (example, error)
[show source]
# File lib/spec/runner/reporter.rb, line 39
      def example_failed(example, error)
        backtrace_tweaker.tweak_backtrace(error)
        failure = Failure.new(@example_group.description, example.description, error)
        @failures << failure
        formatters.each do |f|
          f.example_failed(example, @failures.length, failure)
        end
      end
example_finished (example, error=nil)
[show source]
# File lib/spec/runner/reporter.rb, line 27
      def example_finished(example, error=nil)
        @example_count += 1
        
        if error.nil?
          example_passed(example)
        elsif Spec::Example::ExamplePendingError === error
          example_pending(example, example.location, error.message)
        else
          example_failed(example, error)
        end
      end
example_group_started (example_group)
[show source]
# File lib/spec/runner/reporter.rb, line 16
      def example_group_started(example_group)
        @example_group = example_group
        formatters.each do |f|
          f.example_group_started(example_group)
        end
      end
example_started (example)
[show source]
# File lib/spec/runner/reporter.rb, line 23
      def example_started(example)
        formatters.each{|f| f.example_started(example)}
      end
start (number_of_examples)
[show source]
# File lib/spec/runner/reporter.rb, line 48
      def start(number_of_examples)
        @start_time = Time.new
        formatters.each{|f| f.start(number_of_examples)}
      end