Class: RSpec::Rewind::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/rewind/event.rb

Constant Summary collapse

FIELDS =
%i[
  schema_version
  status
  retry_reason
  decision_reason
  example_id
  description
  location
  attempt
  retries
  max_attempts
  exception_class
  exception_message
  exception_backtrace_top
  failure_fingerprint
  duration
  total_duration
  attempt_durations
  first_failure_duration
  sleep_seconds
  scheduled_sleep_seconds
  actual_sleep_seconds
  sleep_total
  timestamp
  budget_limit
  budget_used
  budget_remaining
  matched_retry_on
  matched_skip_retry_on
  matcher_error
  metadata
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Event

Returns a new instance of Event.



43
44
45
46
47
48
49
# File 'lib/rspec/rewind/event.rb', line 43

def initialize(**attributes)
  FIELDS.each do |field|
    instance_variable_set(:"@#{field}", immutable_value(attributes.fetch(field, nil)))
  end

  freeze
end

Instance Method Details

#to_hObject



51
52
53
54
55
# File 'lib/rspec/rewind/event.rb', line 51

def to_h
  FIELDS.to_h do |field|
    [field, public_send(field)]
  end
end