class RSpec::Core::Notifications::ExampleNotification

Public Class Methods

@private

# File rspec-core/lib/rspec/core/notifications.rb, line 41
def self.for(example)
  execution_result = example.execution_result

  return SkippedExampleNotification.new(example) if execution_result.example_skipped?
  return new(example) unless execution_result.status == :pending || execution_result.status == :failed

  klass = if execution_result.pending_fixed?
            PendingExampleFixedNotification
          elsif execution_result.status == :pending
            PendingExampleFailedAsExpectedNotification
          else
            FailedExampleNotification
          end

  klass.new(example)
end