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 NOTICE: RSpec's formatters have changed example_pending to accept three arguments instead of just two. Please see the rdoc for Spec::Runner::Formatter::BaseFormatter#example_pending for more information. Please update any custom formatters to accept the third argument to example_pending. Support for example_pending with two arguments and this warning message will be removed after the RSpec 1.1.5 release. WARNING

Attributes

example_groups [R]
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
        clear
      end

Public instance methods

add_example_group (example_group)
[show source]
# File lib/spec/runner/reporter.rb, line 12
      def add_example_group(example_group)
        formatters.each do |f|
          f.add_example_group(example_group)
        end
        example_groups << example_group
      end
dump ()

Dumps the summary and returns the total number of failures

[show source]
# File lib/spec/runner/reporter.rb, line 55
      def dump
        formatters.each{|f| f.start_dump}
        dump_pending
        dump_failures
        formatters.each do |f|
          f.dump_summary(duration, @examples.length, @failures.length, @pending_count)
          f.close
        end
        @failures.length
      end
end ()
[show source]
# File lib/spec/runner/reporter.rb, line 50
      def end
        @end_time = Time.new
      end
example_failed (example, error)
[show source]
# File lib/spec/runner/reporter.rb, line 35
      def example_failed(example, error)
        backtrace_tweaker.tweak_backtrace(error)
        failure = Failure.new(example_groups.empty? ? "" : example_groups.last.description, example, 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 23
      def example_finished(example, error=nil)
        @examples << example
        
        if error.nil?
          example_passed(example)
        elsif Spec::Example::ExamplePendingError === error
          example_pending(example, error.pending_caller, error.message)
        else
          example_failed(example, error)
        end
      end
example_started (example)
[show source]
# File lib/spec/runner/reporter.rb, line 19
      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 44
      def start(number_of_examples)
        clear
        @start_time = Time.new
        formatters.each{|f| f.start(number_of_examples)}
      end