Represents the result of executing an example. Behaves like a hash for backwards compatibility.
@return [Exception, nil] The failure, if there was one.
@return [Time] When the example finished.
@return [Exception, nil] The exception triggered while
executing the pending example. If no exception was triggered it would no longer get a status of `:pending` unless it was tagged with `:skip`.
@return [Boolean] For examples tagged with `:pending`,
this indicates whether or not it now passes.
@return [Boolean] For examples tagged with `:pending`,
this indicates whether or not it now passes.
@return [String, nil] The reason the example was pending,
or nil if the example was not pending.
@return [Float] How long the example took in seconds.
@return [Time] When the example started.
@return [Symbol] `:passed`, `:failed` or `:pending`.
@api private Records the finished status of the example.
# File lib/rspec/core/example.rb, line 423 def record_finished(status, finished_at) self.status = status self.finished_at = finished_at self.run_time = (finished_at - started_at).to_f end
# File lib/rspec/core/example.rb, line 444 def get_value(name) if name == :status status.to_s if status else super end end
For backwards compatibility we present `status` as a string when presenting the legacy hash interface.
# File lib/rspec/core/example.rb, line 433 def hash_for_delegation super.tap do |hash| hash[:status] &&= status.to_s end end
# File lib/rspec/core/example.rb, line 452 def issue_deprecation(method_name, *args) RSpec.deprecate("Treating `metadata[:execution_result]` as a hash", :replacement => "the attributes methods to access the data") end
# File lib/rspec/core/example.rb, line 439 def set_value(name, value) value &&= value.to_sym if name == :status super(name, value) end