Parent

Class/Module Index [+]

Quicksearch

RSpec::Core::Notifications::ExamplesNotification

The `ExamplesNotification` represents notifications sent by the reporter which contain information about the suites examples.

@example

def stop(notification)
  puts "Hey I ran #{notification.examples.size}"
end

Public Class Methods

new(reporter) click to toggle source
# File lib/rspec/core/notifications.rb, line 58
def initialize(reporter)
  @reporter = reporter
end

Public Instance Methods

examples() click to toggle source

@return [Array(RSpec::Core::Example)] list of examples

# File lib/rspec/core/notifications.rb, line 63
def examples
  @reporter.examples
end
failed_examples() click to toggle source

@return [Array(RSpec::Core::Example)] list of failed examples

# File lib/rspec/core/notifications.rb, line 68
def failed_examples
  @reporter.failed_examples
end
failure_notifications() click to toggle source

@return [Array(Rspec::Core::Notifications::FailedExampleNotification]

returns failed examples as notifications
# File lib/rspec/core/notifications.rb, line 85
def failure_notifications
  @failed_notifications ||= format(failed_examples)
end
fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) click to toggle source

@return [String] The list of failed examples, fully formatted in the way that

RSpec's built-in formatters emit.
# File lib/rspec/core/notifications.rb, line 91
def fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes)
  formatted = "\nFailures:\n"

  failure_notifications.each_with_index do |failure, index|
    formatted << failure.fully_formatted(index.next, colorizer)
  end

  formatted
end
fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) click to toggle source

@return [String] The list of pending examples, fully formatted in the way that

RSpec's built-in formatters emit.
# File lib/rspec/core/notifications.rb, line 103
def fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes)
  formatted = "\nPending:\n"

  pending_examples.each do |example|
    formatted_caller = RSpec.configuration.backtrace_formatter.backtrace_line(example.location)

    formatted <<
      "  #{colorizer.wrap(example.full_description, :pending)}\n" <<
      "    # #{colorizer.wrap(example.execution_result.pending_message, :detail)}\n" <<
      "    # #{colorizer.wrap(formatted_caller, :detail)}\n"
  end

  formatted
end
notifications() click to toggle source

@return [Array(Rspec::Core::Notifications::ExampleNotification]

returns examples as notifications
# File lib/rspec/core/notifications.rb, line 79
def notifications
  @notifications ||= format(examples)
end
pending_examples() click to toggle source

@return [Array(RSpec::Core::Example)] list of pending examples

# File lib/rspec/core/notifications.rb, line 73
def pending_examples
  @reporter.pending_examples
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.