class RSpec::Core::Example::ExecutionResult

Behaves like a hash for backwards compatibility.
Represents the result of executing an example.

def calculate_run_time(finished_at)

def calculate_run_time(finished_at)
  self.finished_at = finished_at
  self.run_time    = (finished_at - started_at).to_f
end

def ensure_timing_set(clock)

Other tags:
    Api: - private
def ensure_timing_set(clock)
  calculate_run_time(clock.now) unless finished_at
end

def example_skipped?

Returns:
  • (Boolean) - Indicates if the example was completely skipped
def example_skipped?
  status == :pending && !pending_exception
end

def get_value(name)

def get_value(name)
  if name == :status
    status.to_s if status
  else
    super
  end
end

def hash_for_delegation

when presenting the legacy hash interface.
For backwards compatibility we present `status` as a string
def hash_for_delegation
  super.tap do |hash|
    hash[:status] &&= status.to_s
  end
end

def issue_deprecation(_method_name, *_args)

def issue_deprecation(_method_name, *_args)
  RSpec.deprecate("Treating `metadata[:execution_result]` as a hash",
                  :replacement => "the attributes methods to access the data")
end

def record_finished(status, finished_at)

Other tags:
    Api: - private
def record_finished(status, finished_at)
  self.status = status
  calculate_run_time(finished_at)
end

def set_value(name, value)

def set_value(name, value)
  value &&= value.to_sym if name == :status
  super(name, value)
end